|
From: <sv...@va...> - 2005-05-12 05:13:07
|
Author: njn
Date: 2005-05-12 06:13:04 +0100 (Thu, 12 May 2005)
New Revision: 3672
Added:
trunk/coregrind/m_dispatch/
trunk/coregrind/m_dispatch/Makefile.am
trunk/coregrind/m_dispatch/dispatch-amd64.S
trunk/coregrind/m_dispatch/dispatch-arm.S
trunk/coregrind/m_dispatch/dispatch-x86.S
trunk/coregrind/pub_core_dispatch.h
Removed:
trunk/coregrind/amd64/dispatch.S
trunk/coregrind/arm/dispatch.S
trunk/coregrind/x86/dispatch.S
Modified:
trunk/configure.in
trunk/coregrind/Makefile.am
trunk/coregrind/amd64/Makefile.am
trunk/coregrind/arm/Makefile.am
trunk/coregrind/core.h
trunk/coregrind/vg_scheduler.c
trunk/coregrind/x86/Makefile.am
Log:
Modularised the dispatchers in m_dispatch.
Modified: trunk/configure.in
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/configure.in 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/configure.in 2005-05-12 05:13:04 UTC (rev 3672)
@@ -393,8 +393,9 @@
include/x86-linux/Makefile=20
auxprogs/Makefile
coregrind/Makefile=20
+ coregrind/m_aspacemgr/Makefile=20
coregrind/m_demangle/Makefile=20
- coregrind/m_aspacemgr/Makefile=20
+ coregrind/m_dispatch/Makefile=20
coregrind/m_replacemalloc/Makefile=20
coregrind/m_sigframe/Makefile=20
coregrind/m_syscalls/Makefile=20
Modified: trunk/coregrind/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/Makefile.am 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/Makefile.am 2005-05-12 05:13:04 UTC (rev 3672)
@@ -2,8 +2,9 @@
include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
=20
MODULES =3D \
+ m_aspacemgr \
m_demangle \
- m_aspacemgr \
+ m_dispatch \
m_replacemalloc \
m_sigframe \
m_syscalls
@@ -40,6 +41,7 @@
pub_core_aspacemgr.h \
pub_core_debuglog.h \
pub_core_demangle.h \
+ pub_core_dispatch.h \
pub_core_errormgr.h \
pub_core_execontext.h \
pub_core_mallocfree.h \
@@ -96,6 +98,7 @@
=20
## libplatform.a must be before libarch.a and libos.a, it seems.
stage2_extra=3D \
+ m_dispatch/libdispatch.a \
m_demangle/libdemangle.a \
m_aspacemgr/libaspacemgr.a \
m_sigframe/libsigframe.a \
Modified: trunk/coregrind/amd64/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/amd64/Makefile.am 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/amd64/Makefile.am 2005-05-12 05:13:04 UTC (rev 3672)
@@ -19,7 +19,6 @@
libarch_a_SOURCES =3D \
cpuid.S \
helpers.S \
- dispatch.S \
jmp_with_stack.c \
state.c
=20
Deleted: trunk/coregrind/amd64/dispatch.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/amd64/dispatch.S 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/amd64/dispatch.S 2005-05-12 05:13:04 UTC (rev 3672)
@@ -1,217 +0,0 @@
-
-##--------------------------------------------------------------------##
-##--- The core dispatch loop, for jumping to a code address. ---##
-##--- amd64/dispatch.S ---##
-##--------------------------------------------------------------------##
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Julian Seward=20
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#include "core_asm.h"
-#include "libvex_guest_offsets.h" /* for OFFSET_amd64_RIP */
-
-
-/*------------------------------------------------------------*/
-/*--- The dispatch loop. ---*/
-/*------------------------------------------------------------*/
-
-/* signature: UWord VG_(run_innerloop) ( void* guest_state ) */
-
-.globl VG_(run_innerloop)
-VG_(run_innerloop):
- /* %rdi holds guest_state */
-=09
- /* ----- entry point to VG_(run_innerloop) ----- */
- pushq %rbx
- pushq %rcx
- pushq %rdx
- pushq %rsi
- pushq %rbp
- pushq %r8
- pushq %r9
- pushq %r10
- pushq %r11
- pushq %r12
- pushq %r13
- pushq %r14
- pushq %r15
- pushq %rdi
-
- movq VG_(dispatch_ctr)@GOTPCREL(%rip), %rsi
- pushq (%rsi)
-
- /* 8(%rsp) holds cached copy of guest_state */
- /* 0(%rsp) holds cached copy of VG_(dispatch_ctr) */
-
- /* Set up the guest state pointer */
- movq %rdi, %rbp
-=09
- /* fetch %RIP into %rax */
- movq OFFSET_amd64_RIP(%rbp), %rax
-
- /* set host FPU control word to the default mode expected=20
- by VEX-generated code. See comments in libvex.h for
- more info. */
- finit
- pushq $0x027F
- fldcw (%rsp)
- addq $8, %rsp
-=09
- /* set host SSE control word to the default mode expected=20
- by VEX-generated code. */
- pushq $0x1F80
- ldmxcsr (%rsp)
- addq $8, %rsp
-
- /* set dir flag to known value */
- cld
-
- /* fall into main loop */
-
- /* Here, %rax 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 */
- movq %rax, OFFSET_amd64_RIP(%rbp)
-
- /* Are we out of timeslice? If yes, defer to scheduler. */
- subl $1, 0(%rsp)
- jz counter_is_zero
-
- /* try a fast lookup in the translation cache */
- movq %rax, %rbx
- andq $VG_TT_FAST_MASK, %rbx
- movq VG_(tt_fast)@GOTPCREL(%rip), %rcx
- movq (%rcx,%rbx,8), %rcx
- cmpq %rax, (%rcx)
- jnz fast_lookup_failed
- /* increment bb profile counter */
- movq VG_(tt_fastN)@GOTPCREL(%rip), %rdx
- movq (%rdx,%rbx,8), %rdx
- incl (%rdx)
-
- /* Found a match. Call tce[1], which is 8 bytes along, since
- each tce element is a 64-bit int. */
- addq $8, %rcx
- call *%rcx
-
- /*=20
- %rax holds destination (original) address.
- %rbp indicates further details of the control transfer
- requested to the address in %rax.
-=09
- If rbp is unchanged (=3D=3D * 8(%rsp)), just jump next to %rax.
-
- Otherwise fall out, back to the scheduler, and let it
- figure out what to do next.
- */
-
- cmpq 8(%rsp), %rbp
- jz dispatch_boring
-
- jmp dispatch_exceptional
-
-
-
-/* All exits from the dispatcher go through here. %rax holds
- the return value.=20
-*/
-run_innerloop_exit:=20
- /* We're leaving. Check that nobody messed with
- %mxcsr or %fpucw. We can't mess with %rax here as it
- holds the tentative return value, but any other is OK. */
- pushq $0
- fstcw (%rsp)
- cmpl $0x027F, (%rsp)
- popq %r11 /* get rid of the word without trashing %eflags */
- jnz invariant_violation
- pushq $0
- stmxcsr (%rsp)
- andl $0xFFFFFFC0, (%rsp) /* mask out status flags */
- cmpl $0x1F80, (%rsp)
- popq %r11
- jnz invariant_violation
- /* otherwise we're OK */
- jmp run_innerloop_exit_REALLY
-
-invariant_violation:
- movq $VG_TRC_INVARIANT_FAILED, %rax
- jmp run_innerloop_exit_REALLY
-
-run_innerloop_exit_REALLY:
- movq VG_(dispatch_ctr)@GOTPCREL(%rip), %rsi
- popq (%rsi)
- popq %rdi
- popq %r15
- popq %r14
- popq %r13
- popq %r12
- popq %r11
- popq %r10
- popq %r9
- popq %r8
- popq %rbp
- popq %rsi
- popq %rdx
- popq %rcx
- popq %rbx
- ret=09
-
-=09
-=09
-/* Other ways of getting out of the inner loop. Placed out-of-line to
- make it look cleaner.=20
-*/
-dispatch_exceptional:
- /* this is jumped to only, not fallen-through from above */
- cmpq $VG_TRC_INNER_COUNTERZERO, %rbp
- jz counter_is_zero
-
- /* save %rax in %RIP and defer to sched */
- movq 8(%rsp), %rdi
- movq %rax, OFFSET_amd64_RIP(%rdi)
- movq %rbp, %rax
- jmp run_innerloop_exit
-
-fast_lookup_failed:
- /* %RIP is up to date here since dispatch_boring dominates */
- addl $1, 0(%rsp)
- movq $VG_TRC_INNER_FASTMISS, %rax
- jmp run_innerloop_exit
-
-counter_is_zero:
- /* %RIP is up to date here since dispatch_boring dominates */
- addl $1, 0(%rsp)
- movq $VG_TRC_INNER_COUNTERZERO, %rax
- jmp run_innerloop_exit
-
-
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
-##--------------------------------------------------------------------##
-##--- end ---##
-##--------------------------------------------------------------------##
Modified: trunk/coregrind/arm/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/arm/Makefile.am 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/arm/Makefile.am 2005-05-12 05:13:04 UTC (rev 3672)
@@ -17,7 +17,6 @@
CLEANFILES =3D stage2.lds
=20
libarch_a_SOURCES =3D \
- dispatch.S \
state.c
=20
if USE_PIE
Deleted: trunk/coregrind/arm/dispatch.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/arm/dispatch.S 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/arm/dispatch.S 2005-05-12 05:13:04 UTC (rev 3672)
@@ -1,41 +0,0 @@
-
-##--------------------------------------------------------------------##
-##--- The core dispatch loop, for jumping to a code address. ---##
-##--- arm/dispatch.S ---##
-##--------------------------------------------------------------------##
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Julian Seward=20
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#include "core_asm.h"
-
-.globl VG_(run_innerloop)
-VG_(run_innerloop):
- # this needs some improvement...
- swi
-
-##--------------------------------------------------------------------##
-##--- end ---##
-##--------------------------------------------------------------------##
Modified: trunk/coregrind/core.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/core.h 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/core.h 2005-05-12 05:13:04 UTC (rev 3672)
@@ -661,9 +661,6 @@
=20
extern Addr VG_(reverse_search_one_symtab) ( const SegInfo* si, const Ch=
ar* name );
=20
-/* Set up some default redirects */
-extern void VG_(setup_code_redirect_table) ( void );
-
extern Bool VG_(resolve_redir_allsegs)(CodeRedirect *redir);
=20
extern Bool VG_(use_CFI_info) ( /*MOD*/Addr* ipP,
@@ -676,9 +673,13 @@
/* ---------------------------------------------------------------------
Exports of vg_redir.c
------------------------------------------------------------------ */
+
/* Redirection machinery */
extern Addr VG_(code_redirect) ( Addr orig );
=20
+/* Set up some default redirects */
+extern void VG_(setup_code_redirect_table) ( void );
+
extern void VG_(add_redirect_sym_to_addr)(const Char *from_lib,
const Char *from_sym,
Addr to_addr);
@@ -824,25 +825,6 @@
extern void VG_(sigreturn)(void);
=20
/* ---------------------------------------------------------------------
- Exports of vg_dispatch.S
- ------------------------------------------------------------------ */
-
-/* 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 pa=
st
- 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 UWord VG_(run_innerloop) ( void* guest_state );
-
-/* ---------------------------------------------------------------------
Exports of vg_helpers.S
------------------------------------------------------------------ */
=20
Added: trunk/coregrind/m_dispatch/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/m_dispatch/Makefile.am 2005-05-12 04:37:27 UTC (rev 3=
671)
+++ trunk/coregrind/m_dispatch/Makefile.am 2005-05-12 05:13:04 UTC (rev 3=
672)
@@ -0,0 +1,17 @@
+include $(top_srcdir)/Makefile.all.am
+include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
+
+AM_CFLAGS =3D $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O =
-g
+
+noinst_LIBRARIES =3D libdispatch.a
+
+## XXX: this won't work with "make dist" -- only one dispatch-XXX.S file
+## will be put in the tarball. Problem exists in various other Makefile=
s.
+libdispatch_a_SOURCES =3D \
+ dispatch-@VG_ARCH@.S
+
+if USE_PIE
+libdispatch_a_CFLAGS =3D $(AM_CFLAGS) -fpie
+else
+libdispatch_a_CFLAGS =3D $(AM_CFLAGS)
+endif
Copied: trunk/coregrind/m_dispatch/dispatch-amd64.S (from rev 3670, trunk=
/coregrind/amd64/dispatch.S)
Copied: trunk/coregrind/m_dispatch/dispatch-arm.S (from rev 3670, trunk/c=
oregrind/arm/dispatch.S)
Copied: trunk/coregrind/m_dispatch/dispatch-x86.S (from rev 3670, trunk/c=
oregrind/x86/dispatch.S)
Added: trunk/coregrind/pub_core_dispatch.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/pub_core_dispatch.h 2005-05-12 04:37:27 UTC (rev 3671=
)
+++ trunk/coregrind/pub_core_dispatch.h 2005-05-12 05:13:04 UTC (rev 3672=
)
@@ -0,0 +1,61 @@
+
+/*--------------------------------------------------------------------*/
+/*--- The dispatcher. pub_core_dispatch.h ---*/
+/*--------------------------------------------------------------------*/
+
+/*
+ This file is part of Valgrind, a dynamic binary instrumentation
+ framework.
+
+ Copyright (C) 2000-2005 Julian Seward
+ js...@ac...
+
+ This program is free software; you can redistribute it and/or
+ modify it under the terms of the GNU General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307, USA.
+
+ The GNU General Public License is contained in the file COPYING.
+*/
+
+#ifndef __PUB_CORE_DISPATCH_H
+#define __PUB_CORE_DISPATCH_H
+
+//--------------------------------------------------------------------
+// PURPOSE: This module deals with management of the entire process
+// address space. Almost everything depends upon it, including dynamic
+// memory management. Hence this module is almost completely
+// standalone; the only module it uses is m_debuglog. DO NOT CHANGE
+// THIS.
+//--------------------------------------------------------------------
+
+/* 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 pa=
st
+ 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 UWord VG_(run_innerloop) ( void* guest_state );
+
+#endif // __PUB_CORE_DISPATCH_H
+
+/*--------------------------------------------------------------------*/
+/*--- end ---*/
+/*--------------------------------------------------------------------*/
Modified: trunk/coregrind/vg_scheduler.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/vg_scheduler.c 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/vg_scheduler.c 2005-05-12 05:13:04 UTC (rev 3672)
@@ -60,6 +60,7 @@
VG_USERREQ__DISCARD_TRANSLATIONS, and other=
s */
#include "core.h"
=20
+#include "pub_core_dispatch.h"
#include "pub_core_errormgr.h"
#include "pub_core_replacemalloc.h"
#include "pub_core_stacktrace.h"
Modified: trunk/coregrind/x86/Makefile.am
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/x86/Makefile.am 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/x86/Makefile.am 2005-05-12 05:13:04 UTC (rev 3672)
@@ -19,7 +19,6 @@
libarch_a_SOURCES =3D \
cpuid.S \
helpers.S \
- dispatch.S \
jmp_with_stack.c \
state.c
=20
Deleted: trunk/coregrind/x86/dispatch.S
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/coregrind/x86/dispatch.S 2005-05-12 04:37:27 UTC (rev 3671)
+++ trunk/coregrind/x86/dispatch.S 2005-05-12 05:13:04 UTC (rev 3672)
@@ -1,193 +0,0 @@
-
-##--------------------------------------------------------------------##
-##--- The core dispatch loop, for jumping to a code address. ---##
-##--- x86/dispatch.S ---##
-##--------------------------------------------------------------------##
-
-/*
- This file is part of Valgrind, a dynamic binary instrumentation
- framework.
-
- Copyright (C) 2000-2005 Julian Seward=20
- js...@ac...
-
- This program is free software; you can redistribute it and/or
- modify it under the terms of the GNU General Public License as
- published by the Free Software Foundation; either version 2 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
- 02111-1307, USA.
-
- The GNU General Public License is contained in the file COPYING.
-*/
-
-#include "core_asm.h"
-#include "libvex_guest_offsets.h" /* for OFFSET_x86_EIP */
-
-
-/*------------------------------------------------------------*/
-/*--- The dispatch loop. ---*/
-/*------------------------------------------------------------*/
-
-/* signature: UWord VG_(run_innerloop) ( void* guest_state ) */
-
-.globl VG_(run_innerloop)
-VG_(run_innerloop):
- /* 4(%esp) holds guest_state */
-=09
- /* ----- entry point to VG_(run_innerloop) ----- */
- pushl %ebx
- pushl %ecx
- pushl %edx
- pushl %esi
- pushl %edi
- pushl %ebp
-=09
- /* 28(%esp) holds guest_state */
-
- /* Set up the guest state pointer */
- movl 28(%esp), %ebp
-=09
- /* fetch %EIP into %eax */
- movl OFFSET_x86_EIP(%ebp), %eax
-
- /* set host FPU control word to the default mode expected=20
- by VEX-generated code. See comments in libvex.h for
- more info. */
- finit
- pushl $0x027F
- fldcw (%esp)
- addl $4, %esp
-=09
- /* set host SSE control word to the default mode expected=20
- by VEX-generated code. */
- pushl $0x1F80
- ldmxcsr (%esp)
- addl $4, %esp
-
- /* set dir flag to known value */
- cld
-=09
- /* 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 %eax, OFFSET_x86_EIP(%ebp)
-
- /* Are we out of timeslice? If yes, defer to scheduler. */
- subl $1, VG_(dispatch_ctr)
- jz counter_is_zero
-
- /* try a fast lookup in the translation cache */
- movl %eax, %ebx
- andl $VG_TT_FAST_MASK, %ebx
- movl VG_(tt_fast)(,%ebx,4), %ecx
- cmpl %eax, (%ecx)
- jnz fast_lookup_failed
- /* increment bb profile counter */
- movl VG_(tt_fastN)(,%ebx,4), %edx
- incl (%edx)
-
- /* Found a match. Call tce[1], which is 8 bytes along, since
- each tce element is a 64-bit int. */
- addl $8, %ecx
- call *%ecx
-=09
- /*=20
- %eax holds destination (original) address.
- %ebp indicates further details of the control transfer
- requested to the address in %eax.
-=09
- If ebp is unchanged (=3D=3D * 28(%esp)), just jump next to %eax.
-
- Otherwise fall out, back to the scheduler, and let it
- figure out what to do next.
- */
-
- cmpl 28(%esp), %ebp
- jz dispatch_boring
-
- jmp dispatch_exceptional
-
-=09
-
-/* All exits from the dispatcher go through here. %eax holds
- the return value.=20
-*/
-run_innerloop_exit:=20
- /* We're leaving. Check that nobody messed with
- %mxcsr or %fpucw. We can't mess with %eax here as it
- holds the tentative return value, but any other is OK. */
- pushl $0
- fstcw (%esp)
- cmpl $0x027F, (%esp)
- popl %esi /* get rid of the word without trashing %eflags */
- jnz invariant_violation
- pushl $0
- stmxcsr (%esp)
- andl $0xFFFFFFC0, (%esp) /* mask out status flags */
- cmpl $0x1F80, (%esp)
- popl %esi
- jnz invariant_violation
- /* otherwise we're OK */
- jmp run_innerloop_exit_REALLY
-
-invariant_violation:
- movl $VG_TRC_INVARIANT_FAILED, %eax
- jmp run_innerloop_exit_REALLY
-
-run_innerloop_exit_REALLY:
- popl %ebp
- popl %edi
- popl %esi
- popl %edx
- popl %ecx
- popl %ebx
- ret=09
-
-
-
-/* Other ways of getting out of the inner loop. Placed out-of-line to
- make it look cleaner.=20
-*/
-dispatch_exceptional:
- /* this is jumped to only, not fallen-through from above */
- cmpl $VG_TRC_INNER_COUNTERZERO, %ebp
- jz counter_is_zero
-
- /* save %eax in %EIP and defer to sched */
- movl 28(%esp), %edi
- movl %eax, OFFSET_x86_EIP(%edi)
- movl %ebp, %eax
- jmp run_innerloop_exit
-
-fast_lookup_failed:
- /* %EIP is up to date here since dispatch_boring dominates */
- addl $1, VG_(dispatch_ctr)
- movl $VG_TRC_INNER_FASTMISS, %eax
- jmp run_innerloop_exit
-
-counter_is_zero:
- /* %EIP is up to date here since dispatch_boring dominates */
- addl $1, VG_(dispatch_ctr)
- movl $VG_TRC_INNER_COUNTERZERO, %eax
- jmp run_innerloop_exit
-
-=09
-/* Let the linker know we don't need an executable stack */
-.section .note.GNU-stack,"",@progbits
-
-##--------------------------------------------------------------------##
-##--- end ---##
-##--------------------------------------------------------------------##
|