]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Completely get rid of VG_(instr_ptr_offset).
authorJulian Seward <jseward@acm.org>
Wed, 30 Mar 2005 19:04:29 +0000 (19:04 +0000)
committerJulian Seward <jseward@acm.org>
Wed, 30 Mar 2005 19:04:29 +0000 (19:04 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3484

coregrind/core.h
coregrind/vg_main.c
coregrind/vg_scheduler.c
coregrind/x86/dispatch.S

index 134b1d0e59fc186e125db4f42b43d9be83ec3b1e..8c6f1aef9b1fe2df06c433cf54d2b27cb033cd9f 100644 (file)
@@ -994,9 +994,6 @@ extern void VG_(start_debugger) ( ThreadId tid );
 /* Counts downwards in vg_run_innerloop. */
 extern UInt VG_(dispatch_ctr);
 
-/* Instruction pointer guest state offset, used by $VG_ARCH/dispatch.S. */
-extern OffT VG_(instr_ptr_offset);
-
 /* Stats ... */
 extern void VG_(print_scheduler_stats) ( void );
 
@@ -1607,7 +1604,7 @@ extern void VG_(sigreturn)(void);
    address is found in the translation cache.  For anything else, the
    scheduler does the work.
 */
-extern UInt VG_(run_innerloop) ( void* guest_state );
+extern UWord VG_(run_innerloop) ( void* guest_state );
 
 /* ---------------------------------------------------------------------
    Exports of vg_helpers.S
index 05893008c0b3490d37805325fcb408129bfeaa1c..dbbe03bc8207e29ade277eb04a60388f6388451f 100644 (file)
@@ -148,9 +148,6 @@ Int    VG_(client_argc);
 Char** VG_(client_argv);
 Char** VG_(client_envp);
 
-// Instruction pointer guest state offset, used by $VG_ARCH/dispatch.S.
-OffT VG_(instr_ptr_offset);
-
 /* Indicates what arch and subarch we are running on. */
 VexArch    VG_(vex_arch)    = VexArch_INVALID;
 VexSubArch VG_(vex_subarch) = VexSubArch_INVALID;
@@ -2685,9 +2682,6 @@ int main(int argc, char **argv, char **envp)
    VG_TRACK( post_reg_write, Vg_CoreStartup, /*tid*/1, /*offset*/0,
              sizeof(VexGuestArchState));
 
-   // Record the instr ptr offset, for use by asm code.
-   VG_(instr_ptr_offset) = offsetof(VexGuestArchState, VGA_INSTR_PTR);
-
    //--------------------------------------------------------------
    // Initialise the pthread model
    //   p: ?
index 66ff80f377f6e64a6449ea9aae50f244bc20b934..29560eb86550453b9e318cf55500dc38742efb84 100644 (file)
@@ -453,8 +453,6 @@ UInt run_thread_for_a_while ( ThreadId tid )
 {
    volatile Bool jumped;
    volatile ThreadState *tst = VG_(get_ThreadState)(tid);
-   //volatile Addr EIP = tst->arch.m_eip;
-   //volatile Addr nextEIP;
 
    volatile UInt trc = 0;
    volatile Int  dispatch_ctr_SAVED = VG_(dispatch_ctr);
@@ -495,10 +493,6 @@ UInt run_thread_for_a_while ( ThreadId tid )
    vg_assert(sz_spill == LibVEX_N_SPILL_BYTES);
    vg_assert(a_vex + 2 * sz_vex == a_spill);
 
-   vg_assert(VG_(instr_ptr_offset) >= 0);
-   vg_assert(VG_(instr_ptr_offset) <= 10000); /* let's say */
-   vg_assert(sizeof VG_(instr_ptr_offset) == sizeof(HWord));
-
    VGP_PUSHCC(VgpRun);
 
    /* there should be no undealt-with signals */
@@ -509,7 +503,8 @@ UInt run_thread_for_a_while ( ThreadId tid )
    vg_assert(VG_(my_fault));
    VG_(my_fault) = False;
 
-   SCHEDSETJMP(tid, jumped, trc = VG_(run_innerloop)( (void*)&tst->arch.vex ));
+   SCHEDSETJMP(tid, jumped, 
+                    trc = (UInt)VG_(run_innerloop)( (void*)&tst->arch.vex ));
 
    //nextEIP = tst->arch.m_eip;
    //if (nextEIP >= VG_(client_end))
index 13c521b744b3503a11fcc9fa31d8c56e2efe4cef..9a4f0fe6f546423f133fc9efb5e8b81faba0afd8 100644 (file)
 
 #include "core_asm.h"
 #include "x86_private_asm.h"
+#include "libvex_guest_offsets.h"      /* for OFFSET_x86_EIP */
 
 
 /*------------------------------------------------------------*/
 /*--- The dispatch loop.                                   ---*/
 /*------------------------------------------------------------*/
-       
-/* signature: UInt VG_(run_innerloop) ( void* guest_state ) */
+
+/* signature: UWord VG_(run_innerloop) ( void* guest_state ) */
 
 .globl VG_(run_innerloop)
 VG_(run_innerloop):
@@ -57,8 +58,7 @@ VG_(run_innerloop):
        movl    28(%esp), %ebp
        
        /* fetch %EIP into %eax */
-       movl    VG_(instr_ptr_offset), %esi
-       movl    (%ebp, %esi, 1), %eax
+       movl    OFFSET_x86_EIP(%ebp), %eax
 
        /* set host FPU control word to the default mode expected 
            by VEX-generated code.  See comments in libvex.h for
@@ -84,8 +84,7 @@ VG_(run_innerloop):
 
 dispatch_boring:
        /* save the jump address in the guest state */
-       movl    VG_(instr_ptr_offset), %esi
-       movl    %eax, (%ebp, %esi, 1)
+       movl    %eax, OFFSET_x86_EIP(%ebp)
 
        /* Are we out of timeslice?  If yes, defer to scheduler. */
        subl $1, VG_(dispatch_ctr)
@@ -169,9 +168,8 @@ dispatch_exceptional:
        jz      counter_is_zero
 
        /* save %eax in %EIP and defer to sched */
-       movl    VG_(instr_ptr_offset), %esi
        movl    28(%esp), %edi
-       movl    %eax, (%edi, %esi, 1)
+       movl    %eax, OFFSET_x86_EIP(%edi)
        movl    %ebp, %eax
        jmp     run_innerloop_exit