]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Move VG_(have_ssestate) out of core and into coregrind/x86/.
authorNicholas Nethercote <njn@valgrind.org>
Tue, 30 Nov 2004 17:27:21 +0000 (17:27 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Tue, 30 Nov 2004 17:27:21 +0000 (17:27 +0000)
Also fixed up out-of-date comments for run_innerloop.

git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3167

coregrind/core.h
coregrind/vg_main.c
coregrind/x86/dispatch.S
coregrind/x86/state.c
coregrind/x86/x86_private.h

index e8cf7cd1badda52db917af52987dd96dc50e40e7..e14519cd7793f95896c1c68bc145d7f9e567c6f5 100644 (file)
@@ -1178,12 +1178,6 @@ extern Addr VG_(code_redirect) ( Addr orig );
    Exports of vg_main.c
    ------------------------------------------------------------------ */
 
-/* Is this a SSE/SSE2-capable CPU?  If so, we had better save/restore
-   the SSE state all over the place.  This is set up very early, in
-   main().  We have to determine it early since we can't even
-   correctly snapshot the startup machine state without it. */
-extern Bool VG_(have_ssestate);
-
 /* Tell the logging mechanism whether we are logging to a file
    descriptor or a socket descriptor. */
 extern Bool VG_(logging_to_filedes);
@@ -1747,9 +1741,19 @@ extern void VG_(sigreturn)(void);
    Exports of vg_dispatch.S
    ------------------------------------------------------------------ */
 
-/* Run a thread for a (very short) while, until some event happens
-   which means we need to defer to the scheduler.  This is passed
-   a pointer to the VEX guest state (arch.vex). */
+/* This subroutine is called from the C world.  It is passed
+   a pointer to the VEX guest state (arch.vex).  It must run code
+   from the instruction pointer in the guest state, and exit when
+   VG_(dispatch_ctr) reaches zero, or we need to defer to the scheduler.
+   The return value must indicate why it returned back to the scheduler.
+   It can also be exited if the executing code throws a non-resumable
+   signal, for example SIGSEGV, in which case control longjmp()s back past
+   here.
+
+   This code simply handles the common case fast -- when the translation
+   address is found in the translation cache.  For anything else, the
+   scheduler does the work.
+*/
 extern UInt VG_(run_innerloop) ( void* guest_state );
 
 /* ---------------------------------------------------------------------
index d0db0bcf1ba7c34936912bfa2474ffb6312e2166..598b642543d6136f360487d2081822101e5e69fc 100644 (file)
@@ -109,10 +109,6 @@ Addr VG_(valgrind_last);
 struct vki_rlimit VG_(client_rlimit_data);
 struct vki_rlimit VG_(client_rlimit_stack);
 
-/* This is set early to indicate whether this CPU has the
-   SSE/fxsave/fxrestor features.  */
-Bool VG_(have_ssestate);
-
 /* stage1 (main) executable */
 static Int vgexecfd = -1;
 
index 4e4c82700804e4e52fb8e0fa398111f5f0c2f921..b6f5c533f0ad34a79bf06b29ee4309436ded5f7e 100644 (file)
 
 
 /*------------------------------------------------------------*/
-/*--- The normal-case dispatch machinery.                  ---*/
+/*--- The dispatch loop.                                   ---*/
 /*------------------------------------------------------------*/
        
-/* To transfer to an (original) code address, load it into %eax and
-   jump to vg_dispatch.  This fragment of code tries to find the
-   address of the corresponding translation by searching the translation
-   table.   If it fails, a new translation is made, added to the
-   translation table, and then jumped to.  Almost all the hard
-   work is done by C routines; this code simply handles the
-   common case fast -- when the translation address is found in
-   the translation cache.
-
-   At entry, %eax is the only live (real-machine) register; the
-   entire simulated state is tidily saved in vg_m_state.  
-*/
-
-       
 #define TT_LOOKUP(reg, fail)                           \
        movl %eax, reg;                                 \
        andl $VG_TT_FAST_MASK, reg;                     \
        cmpl %eax, (reg);                               \
        jnz  fail
        
-/* The C world needs a way to get started simulating.  So we provide
-   a function void vg_run_innerloop ( void ), which starts running
-   from vg_m_eip, and exits when the counter reaches zero.  This loop
-   can also exit if vg_oursignalhandler() catches a non-resumable
-   signal, for example SIGSEGV.  It then longjmp()s back past here.
-*/
-
 /* signature: UInt VG_(run_innerloop) ( void* guest_state ) */
 
 .globl VG_(run_innerloop)
@@ -84,12 +63,15 @@ VG_(run_innerloop):
        /* Set up the guest state pointer */
        movl    28(%esp), %ebp
        
-       /* fetch m_eip into %eax */
+       /* fetch %EIP into %eax */
        movl    VG_(instr_ptr_offset), %esi
        movl    (%ebp, %esi, 1), %eax
        
        /* fall into main loop */
 
+       /* Here, %eax is the only live (real) register.  The entire
+          simulated state is saved in the ThreadState. */
+
 dispatch_boring:
        /* save the jump address in the guest state */
        movl    VG_(instr_ptr_offset), %esi
index 3b6df205357f302b65391ce43a4454de63f1411e..f8c7cc4932242c360038aeab4667bf0689a2be6e 100644 (file)
 
 #include "libvex_guest_x86.h"
 
+/* This is set early to indicate whether this CPU has the
+   SSE/fxsave/fxrestor features.  */
+Bool VG_(have_ssestate);
+
 /*------------------------------------------------------------*/
 /*--- Initialising the first thread                        ---*/
 /*------------------------------------------------------------*/
index 548232f6dcfddfedf4e226a8f6ef9a28176e6a5a..0a92fa26fb7b4ca1bc7521adce69fcbb4877f0f7 100644 (file)
 #include "x86_private_asm.h"  // private arch-specific asm stuff
 #include "tool_arch.h"        // arch-specific tool stuff
 
+/* ---------------------------------------------------------------------
+   Exports of state.c that are not core-visible
+   ------------------------------------------------------------------ */
+
+/* Is this a SSE/SSE2-capable CPU?  If so, we had better save/restore
+   the SSE state all over the place.  This is set up very early, since we
+   can't even correctly snapshot the startup machine state without it. */
+extern Bool VG_(have_ssestate);
+
 /* ---------------------------------------------------------------------
    Exports of vg_ldt.c
    ------------------------------------------------------------------ */