]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make VEX define the special thread-return-code values it uses.
authorJulian Seward <jseward@acm.org>
Fri, 26 Nov 2004 13:18:19 +0000 (13:18 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 26 Nov 2004 13:18:19 +0000 (13:18 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@590

VEX/Makefile
VEX/priv/host-x86/hdefs.c
VEX/pub/libvex_trc_values.h [new file with mode: 0644]

index 031216f01e1f9c9864693b352804f87b14a831d3..20fb76647c4842222560c227a6f3abeaa3d3a400 100644 (file)
@@ -2,6 +2,7 @@
 PUB_HEADERS =  pub/libvex_basictypes.h                 \
                pub/libvex_ir.h                         \
                pub/libvex.h                            \
+               pub/libvex_trc_values.h                 \
                pub/libvex_guest_x86.h                  \
                pub/libvex_guest_amd64.h                \
                pub/libvex_guest_arm.h
index ccfd28d56798a730e4db0d5a2ea9772f05b04fbd..70e9f8af61c70c91de1e7480b5a2b831a5524053 100644 (file)
@@ -35,6 +35,7 @@
 
 #include "libvex_basictypes.h"
 #include "libvex.h"
+#include "libvex_trc_values.h"
 
 #include "main/vex_util.h"
 #include "host-generic/h_generic_regs.h"
@@ -1718,9 +1719,8 @@ Int emit_X86Instr ( UChar* buf, Int nbuf, X86Instr* i )
       goto done;
 
    case Xin_Goto:
-      /* If a non-boring unconditional jump, set %ebp appropriately.
-         The magic numbers here have to match those defined in
-         vg_constants.h. */
+      /* If a non-boring unconditional jump, set %ebp (the guest state
+         pointer) appropriately. */
       if (i->Xin.Goto.cond == Xcc_ALWAYS
           && (i->Xin.Goto.jk == Ijk_ClientReq 
               || i->Xin.Goto.jk == Ijk_Syscall
@@ -1729,14 +1729,11 @@ Int emit_X86Instr ( UChar* buf, Int nbuf, X86Instr* i )
          *p++ = 0xBD;
          switch (i->Xin.Goto.jk) {
             case Ijk_ClientReq: 
-               /* 23 == VG_TRC_EBP_JMP_CLIENTREQ */
-               p = emit32(p, 23); break;
+               p = emit32(p, VEX_TRC_JMP_CLIENTREQ); break;
             case Ijk_Syscall: 
-               /* 19 == VG_TRC_EBP_JMP_SYSCALL */
-               p = emit32(p, 19); break;
+               p = emit32(p, VEX_TRC_JMP_SYSCALL); break;
             case Ijk_Yield: 
-               /* 27 == VG_TRC_EBP_JMP_YIELD */
-               p = emit32(p, 27); break;
+               p = emit32(p, VEX_TRC_JMP_YIELD); break;
             default: 
                ppIRJumpKind(i->Xin.Goto.jk);
                vpanic("emit_X86Instr.Xin_Goto: unknown jump kind");
diff --git a/VEX/pub/libvex_trc_values.h b/VEX/pub/libvex_trc_values.h
new file mode 100644 (file)
index 0000000..93088f9
--- /dev/null
@@ -0,0 +1,56 @@
+
+/*---------------------------------------------------------------*/
+/*---                                                         ---*/
+/*--- This file (libvex_trc_values.h) is                      ---*/
+/*--- Copyright (c) 2004 OpenWorks LLP.  All rights reserved. ---*/
+/*---                                                         ---*/
+/*---------------------------------------------------------------*/
+
+/*
+   This file is part of LibVEX, a library for dynamic binary
+   instrumentation and translation.
+
+   Copyright (C) 2004 OpenWorks, LLP.
+
+   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; Version 2 dated June 1991 of the
+   license.
+
+   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, or liability
+   for damages.  See the GNU General Public License for more details.
+
+   Neither the names of the U.S. Department of Energy nor the
+   University of California nor the names of its contributors may be
+   used to endorse or promote products derived from this software
+   without prior written permission.
+
+   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.
+*/
+
+#ifndef __LIBVEX_TRC_VALUES_H
+#define __LIBVEX_TRC_VALUES_H
+
+
+/* Magic values that the guest state pointer might be set to when
+   returning to the dispatcher.  The only other legitimate value is to
+   point to the start of the thread's VEX guest state.
+
+   This file may get included in assembly code, so do not put
+   C-specific constructs in it.
+*/
+#define VEX_TRC_JMP_SYSCALL    19  /* do a system call before continuing */
+#define VEX_TRC_JMP_CLIENTREQ  23  /* do a client req before continuing */
+#define VEX_TRC_JMP_YIELD      27  /* yield to thread sched 
+                                      before continuing */
+
+#endif /* ndef __LIBVEX_TRC_VALUES_H */
+
+/*---------------------------------------------------------------*/
+/*---                                     libvex_trc_values.h ---*/
+/*---------------------------------------------------------------*/