From: Julian Seward Date: Wed, 30 Mar 2005 19:04:29 +0000 (+0000) Subject: Completely get rid of VG_(instr_ptr_offset). X-Git-Tag: svn/VALGRIND_3_0_0~834 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=1a4748ff3243474ea21dff7d23ea2a25bb9e18c7;p=thirdparty%2Fvalgrind.git Completely get rid of VG_(instr_ptr_offset). git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3484 --- diff --git a/coregrind/core.h b/coregrind/core.h index 134b1d0e59..8c6f1aef9b 100644 --- a/coregrind/core.h +++ b/coregrind/core.h @@ -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 diff --git a/coregrind/vg_main.c b/coregrind/vg_main.c index 05893008c0..dbbe03bc82 100644 --- a/coregrind/vg_main.c +++ b/coregrind/vg_main.c @@ -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: ? diff --git a/coregrind/vg_scheduler.c b/coregrind/vg_scheduler.c index 66ff80f377..29560eb865 100644 --- a/coregrind/vg_scheduler.c +++ b/coregrind/vg_scheduler.c @@ -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)) diff --git a/coregrind/x86/dispatch.S b/coregrind/x86/dispatch.S index 13c521b744..9a4f0fe6f5 100644 --- a/coregrind/x86/dispatch.S +++ b/coregrind/x86/dispatch.S @@ -31,13 +31,14 @@ #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