]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Modularised the dispatchers in m_dispatch.
authorNicholas Nethercote <njn@valgrind.org>
Thu, 12 May 2005 05:13:04 +0000 (05:13 +0000)
committerNicholas Nethercote <njn@valgrind.org>
Thu, 12 May 2005 05:13:04 +0000 (05:13 +0000)
git-svn-id: svn://svn.valgrind.org/valgrind/trunk@3672

12 files changed:
configure.in
coregrind/Makefile.am
coregrind/amd64/Makefile.am
coregrind/arm/Makefile.am
coregrind/core.h
coregrind/m_dispatch/Makefile.am [new file with mode: 0644]
coregrind/m_dispatch/dispatch-amd64.S [moved from coregrind/amd64/dispatch.S with 100% similarity]
coregrind/m_dispatch/dispatch-arm.S [moved from coregrind/arm/dispatch.S with 100% similarity]
coregrind/m_dispatch/dispatch-x86.S [moved from coregrind/x86/dispatch.S with 100% similarity]
coregrind/pub_core_dispatch.h [new file with mode: 0644]
coregrind/vg_scheduler.c
coregrind/x86/Makefile.am

index 953ca14ed3ab5a3f3d6a2da941b69d2023550d15..679efea497702f36c9683dd22734702dbc679329 100644 (file)
@@ -393,8 +393,9 @@ AC_OUTPUT(
    include/x86-linux/Makefile 
    auxprogs/Makefile
    coregrind/Makefile 
-   coregrind/m_demangle/Makefile 
    coregrind/m_aspacemgr/Makefile 
+   coregrind/m_demangle/Makefile 
+   coregrind/m_dispatch/Makefile 
    coregrind/m_replacemalloc/Makefile 
    coregrind/m_sigframe/Makefile 
    coregrind/m_syscalls/Makefile 
index c430bfa24cc7f0705a7103f69775a9d010ae7311..ea6c454926004123c8b7d53a0e6eaaf015f89589 100644 (file)
@@ -2,8 +2,9 @@ include $(top_srcdir)/Makefile.all.am
 include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
 
 MODULES = \
-       m_demangle \
        m_aspacemgr \
+       m_demangle \
+       m_dispatch \
        m_replacemalloc \
        m_sigframe \
        m_syscalls
@@ -40,6 +41,7 @@ noinst_HEADERS = \
        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 @@ stage2_SOURCES = \
 
 ## libplatform.a must be before libarch.a and libos.a, it seems.
 stage2_extra= \
+       m_dispatch/libdispatch.a \
        m_demangle/libdemangle.a \
        m_aspacemgr/libaspacemgr.a \
        m_sigframe/libsigframe.a \
index 61217394e6105dc2203153b17114c29f8f12c3c5..5baea3a6435d61c2e5a3bcd1b1ae5dbf54dd167c 100644 (file)
@@ -19,7 +19,6 @@ CLEANFILES = stage2.lds
 libarch_a_SOURCES = \
        cpuid.S \
        helpers.S \
-       dispatch.S \
        jmp_with_stack.c \
        state.c
 
index 0ad93dddf320d1fb042dbe1aa456ae4e0afaab31..1bb806eca4c95955125ad4f3e99f9c74ed6bf1f7 100644 (file)
@@ -17,7 +17,6 @@ BUILT_SOURCES = stage2.lds
 CLEANFILES = stage2.lds
 
 libarch_a_SOURCES = \
-       dispatch.S \
        state.c
 
 if USE_PIE
index 82076e1ed037c9a3320420afb66831b2e7cfad11..91bb674d9114c0e539a151d8ad95ce29c45f1f59 100644 (file)
@@ -661,9 +661,6 @@ extern Bool VG_(get_fnname_nodemangle)( Addr a, Char* fnname, Int n_fnname );
 
 extern Addr VG_(reverse_search_one_symtab) ( const SegInfo* si, const Char* name );
 
-/* Set up some default redirects */
-extern void VG_(setup_code_redirect_table) ( void );
-
 extern Bool VG_(resolve_redir_allsegs)(CodeRedirect *redir);
 
 extern Bool VG_(use_CFI_info) ( /*MOD*/Addr* ipP,
@@ -676,9 +673,13 @@ extern Bool VG_(use_CFI_info) ( /*MOD*/Addr* ipP,
 /* ---------------------------------------------------------------------
    Exports of vg_redir.c
    ------------------------------------------------------------------ */
+
 /* Redirection machinery */
 extern Addr VG_(code_redirect) ( Addr orig );
 
+/* 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);
@@ -823,25 +824,6 @@ extern Word VG_(do_syscall) ( UInt, UWord, UWord, UWord, UWord, UWord, UWord );
 
 extern void VG_(sigreturn)(void);
 
-/* ---------------------------------------------------------------------
-   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 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 UWord VG_(run_innerloop) ( void* guest_state );
-
 /* ---------------------------------------------------------------------
    Exports of vg_helpers.S
    ------------------------------------------------------------------ */
diff --git a/coregrind/m_dispatch/Makefile.am b/coregrind/m_dispatch/Makefile.am
new file mode 100644 (file)
index 0000000..d9b5cf6
--- /dev/null
@@ -0,0 +1,17 @@
+include $(top_srcdir)/Makefile.all.am
+include $(top_srcdir)/Makefile.core-AM_CPPFLAGS.am
+
+AM_CFLAGS = $(WERROR) -Wmissing-prototypes -Winline -Wall -Wshadow -O -g
+
+noinst_LIBRARIES = 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 Makefiles.
+libdispatch_a_SOURCES = \
+       dispatch-@VG_ARCH@.S
+
+if USE_PIE
+libdispatch_a_CFLAGS = $(AM_CFLAGS) -fpie
+else
+libdispatch_a_CFLAGS = $(AM_CFLAGS)
+endif
diff --git a/coregrind/pub_core_dispatch.h b/coregrind/pub_core_dispatch.h
new file mode 100644 (file)
index 0000000..e337ad6
--- /dev/null
@@ -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
+      jseward@acm.org
+
+   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 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 UWord VG_(run_innerloop) ( void* guest_state );
+
+#endif   // __PUB_CORE_DISPATCH_H
+
+/*--------------------------------------------------------------------*/
+/*--- end                                                          ---*/
+/*--------------------------------------------------------------------*/
index 87ab433c899835ae8c32b98c8c20cc5157759b6c..8f62a13221e9a9d6eac46fd9000114d01641b7b3 100644 (file)
@@ -60,6 +60,7 @@
                              VG_USERREQ__DISCARD_TRANSLATIONS, and others */
 #include "core.h"
 
+#include "pub_core_dispatch.h"
 #include "pub_core_errormgr.h"
 #include "pub_core_replacemalloc.h"
 #include "pub_core_stacktrace.h"
index 95d4da1a5875a8ced8b8404c0eb10142fcdb63df..65d955233fad81cc4d2f2ad12df18e9d11a734f2 100644 (file)
@@ -19,7 +19,6 @@ CLEANFILES = stage2.lds
 libarch_a_SOURCES = \
        cpuid.S \
        helpers.S \
-       dispatch.S \
        jmp_with_stack.c \
        state.c