]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Integration stuff to make the 104 testbed work.
authorJulian Seward <jseward@acm.org>
Sun, 25 Jul 2004 00:07:35 +0000 (00:07 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 25 Jul 2004 00:07:35 +0000 (00:07 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@117

13 files changed:
VEX/Makefile
VEX/hacked104/Makefile.am
VEX/hacked104/Makefile.in
VEX/hacked104/default.supp
VEX/hacked104/demangle/Makefile.in
VEX/hacked104/vg_from_ucode.c
VEX/hacked104/vg_include.h
VEX/hacked104/vg_main.c
VEX/hacked104/vg_scheduler.c
VEX/hacked104/vg_signals.c
VEX/hacked104/vg_translate.c
VEX/priv/guest-x86/x86guest_defs.h
VEX/priv/guest-x86/x86helpers.c

index d102ae15c32e1d37e47cf17986af985f955918e2..f4a04fcec8568a5651b62f71589c51b3ae1cef73 100644 (file)
@@ -44,8 +44,12 @@ CCFLAGS = -g -Wall -Wshadow
 # 167: argument of type unsigned char incompatible with formal of type char
 # (the above are for icc 8.0 -- 8.0.0.55 I think)
 
-all: libvex.a $(APP_OBJS)
-       $(CC) $(CCFLAGS) -o vex $(APP_OBJS) libvex.a
+all: libvex.a
+       rm -f hacked104/valgrind.so
+       (cd hacked104 && make install)
+
+#all: libvex.a $(APP_OBJS)
+#      $(CC) $(CCFLAGS) -o vex $(APP_OBJS) libvex.a
 
 libvex.a: $(LIB_OBJS)
        rm -f libvex.a
@@ -53,7 +57,7 @@ libvex.a: $(LIB_OBJS)
 
 clean:
        rm -f $(APP_OBJS) $(LIB_OBJS) libvex.a vex
-
+       (cd hacked104 && make clean)
 
 
 
index 7211b8bfbacb958e9841b167eb269b1ea8e237d2..e2a147fa470ab4f7b57acc7cb14d9e14cc9e3eb0 100644 (file)
@@ -1,7 +1,9 @@
 SUBDIRS = demangle . docs tests
 
+#CFLAGS = $(WERROR) -DVG_LIBDIR="\"$(libdir)"\" \
+#              -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
 CFLAGS = $(WERROR) -DVG_LIBDIR="\"$(libdir)"\" \
-               -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
+               -Winline -Wall -Wshadow -g
 
 valdir = $(libdir)/valgrind
 
index 761dd134e1f273f6f68f7b221585037675253169..a63fbd3780b2173e66ee7bf4cfbf617e8744298b 100644 (file)
@@ -74,8 +74,10 @@ VERSION = @VERSION@
 
 SUBDIRS = demangle . docs tests
 
+#CFLAGS = $(WERROR) -DVG_LIBDIR="\"$(libdir)"\" \
+#              -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
 CFLAGS = $(WERROR) -DVG_LIBDIR="\"$(libdir)"\" \
-               -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
+               -Winline -Wall -Wshadow -g
 
 
 valdir = $(libdir)/valgrind
@@ -671,7 +673,7 @@ vg_libpthread.o: vg_libpthread.c $(MANUAL_DEPS)
 
 valgrind.so$(EXEEXT): $(valgrind_so_OBJECTS)
        $(CC) $(CFLAGS) $(LDFLAGS) -shared -o valgrind.so \
-               $(valgrind_so_OBJECTS) $(valgrind_so_LDADD)
+               $(valgrind_so_OBJECTS) $(valgrind_so_LDADD) ../libvex.a
 
 valgrinq.so$(EXEEXT): $(valgrinq_so_OBJECTS)
        $(CC) $(CFLAGS) -shared -o valgrinq.so $(valgrinq_so_OBJECTS)
index 7b913c2ff31478b5b1725d22f5100a04ffa10c71..c9f6a15e2e775bc5fa89b53b70ebd0e779638c46 100644 (file)
@@ -1,6 +1,6 @@
 # This is a generated file, composed of the following suppression rules:
 #
-#       glibc-2.2.supp xfree-3.supp xfree-4.supp
+#       glibc-2.2.supp xfree-4.supp xfree-3.supp
 #
 
 
 ##----------------------------------------------------------------------##
 
 
+##----------------------------------------------------------------------##
+
+# Errors to suppress by default with XFree86 4.1.0)
+
+# Format of this file is:
+# {
+#     name_of_suppression
+#     kind: one of Param Value1 Value2 Value4 Value8
+#                   Free Addr1 Addr2 Addr4 Addr8
+#                   Cond (previously known as Value0)
+#     (if Param: name of system call param, if Free: name of free-ing fn)
+#     caller0 name, or /name/of/so/file.so
+#     caller1 name, or ditto
+#     (optionally: caller2 name)
+#     (optionally: caller3 name)
+#  }
+
+
+{
+   libX11.so.6.2/libX11.so.6.2/libX11.so.6.2(Cond)
+   Cond
+   obj:/usr/X11R6/lib/libX11.so.6.2
+   obj:/usr/X11R6/lib/libX11.so.6.2
+   obj:/usr/X11R6/lib/libX11.so.6.2
+}
+
+{
+   libXt.so.6.2/libXt.so.6.2/libXt.so.6.2(Cond)
+   Cond
+   obj:/usr/X11R6/lib/libXt.so.6.0
+   obj:/usr/X11R6/lib/libXt.so.6.0
+   obj:/usr/X11R6/lib/libXt.so.6.0
+}
+
+
+{
+   libXaw.so.7.0/libXaw.so.7.0/libXaw.so.7.0(Cond)
+   Cond
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+}
+
+{
+   libXmu.so.6.2/libXmu.so.6.2/libXmu.so.6.2(Cond)
+   Cond
+   obj:/usr/X11R6/lib/libXmu.so.6.2
+   obj:/usr/X11R6/lib/libXmu.so.6.2
+   obj:/usr/X11R6/lib/libXmu.so.6.2
+}
+
+{
+   libXt.so.6.0/libXt.so.6.0/libXaw.so.7.0(Cond)
+   Cond
+   obj:/usr/X11R6/lib/libXt.so.6.0
+   obj:/usr/X11R6/lib/libXt.so.6.0
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+}
+
+{
+   libXaw.so.7.0/libXaw.so.7.0/libXt.so.6.0(Value4)
+   Value4
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+   obj:/usr/X11R6/lib/libXt.so.6.0
+}
+
+{
+   libXaw.so.7.0/libXaw.so.7.0/libXt.so.6.0(Cond)
+   Cond
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+   obj:/usr/X11R6/lib/libXt.so.6.0
+}
+
+{
+   libX11.so.6.2/libX11.so.6.2/libXaw.so.7.0(Cond)
+   Cond
+   obj:/usr/X11R6/lib/libX11.so.6.2
+   obj:/usr/X11R6/lib/libX11.so.6.2
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+}
+
+{
+   libX11.so.6.2/libXaw.so.7.0/libXaw.so.7.0(Cond)
+   Cond
+   obj:/usr/X11R6/lib/libX11.so.6.2
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+   obj:/usr/X11R6/lib/libXaw.so.7.0
+}
+
+{
+   libXpm.so.4.11/libXpm.so.4.11/libXpm.so.4.11
+   Cond
+   obj:/usr/X11R6/lib/libXpm.so.4.11
+   obj:/usr/X11R6/lib/libXpm.so.4.11
+   obj:/usr/X11R6/lib/libXpm.so.4.11
+}
+
+
+##----------------------------------------------------------------------##
+
+
 ##----------------------------------------------------------------------##
 
 # Errors to suppress by default with XFree86 3.3.6)
 
 
 ##----------------------------------------------------------------------##
-
-##----------------------------------------------------------------------##
-
-# Errors to suppress by default with XFree86 4.1.0)
-
-# Format of this file is:
-# {
-#     name_of_suppression
-#     kind: one of Param Value1 Value2 Value4 Value8
-#                   Free Addr1 Addr2 Addr4 Addr8
-#                   Cond (previously known as Value0)
-#     (if Param: name of system call param, if Free: name of free-ing fn)
-#     caller0 name, or /name/of/so/file.so
-#     caller1 name, or ditto
-#     (optionally: caller2 name)
-#     (optionally: caller3 name)
-#  }
-
-
-{
-   libX11.so.6.2/libX11.so.6.2/libX11.so.6.2(Cond)
-   Cond
-   obj:/usr/X11R6/lib/libX11.so.6.2
-   obj:/usr/X11R6/lib/libX11.so.6.2
-   obj:/usr/X11R6/lib/libX11.so.6.2
-}
-
-{
-   libXt.so.6.2/libXt.so.6.2/libXt.so.6.2(Cond)
-   Cond
-   obj:/usr/X11R6/lib/libXt.so.6.0
-   obj:/usr/X11R6/lib/libXt.so.6.0
-   obj:/usr/X11R6/lib/libXt.so.6.0
-}
-
-
-{
-   libXaw.so.7.0/libXaw.so.7.0/libXaw.so.7.0(Cond)
-   Cond
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-}
-
-{
-   libXmu.so.6.2/libXmu.so.6.2/libXmu.so.6.2(Cond)
-   Cond
-   obj:/usr/X11R6/lib/libXmu.so.6.2
-   obj:/usr/X11R6/lib/libXmu.so.6.2
-   obj:/usr/X11R6/lib/libXmu.so.6.2
-}
-
-{
-   libXt.so.6.0/libXt.so.6.0/libXaw.so.7.0(Cond)
-   Cond
-   obj:/usr/X11R6/lib/libXt.so.6.0
-   obj:/usr/X11R6/lib/libXt.so.6.0
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-}
-
-{
-   libXaw.so.7.0/libXaw.so.7.0/libXt.so.6.0(Value4)
-   Value4
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-   obj:/usr/X11R6/lib/libXt.so.6.0
-}
-
-{
-   libXaw.so.7.0/libXaw.so.7.0/libXt.so.6.0(Cond)
-   Cond
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-   obj:/usr/X11R6/lib/libXt.so.6.0
-}
-
-{
-   libX11.so.6.2/libX11.so.6.2/libXaw.so.7.0(Cond)
-   Cond
-   obj:/usr/X11R6/lib/libX11.so.6.2
-   obj:/usr/X11R6/lib/libX11.so.6.2
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-}
-
-{
-   libX11.so.6.2/libXaw.so.7.0/libXaw.so.7.0(Cond)
-   Cond
-   obj:/usr/X11R6/lib/libX11.so.6.2
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-   obj:/usr/X11R6/lib/libXaw.so.7.0
-}
-
-{
-   libXpm.so.4.11/libXpm.so.4.11/libXpm.so.4.11
-   Cond
-   obj:/usr/X11R6/lib/libXpm.so.4.11
-   obj:/usr/X11R6/lib/libXpm.so.4.11
-   obj:/usr/X11R6/lib/libXpm.so.4.11
-}
-
-
-##----------------------------------------------------------------------##
-
index 71a1c272d0c9cb6263cd6b3eb6b381726a9c6d59..47e07b3106ca5f960b2d2565bc9dbbc501ff1e1f 100644 (file)
@@ -74,7 +74,8 @@ VERSION = @VERSION@
 
 INCLUDES = -I$(top_srcdir)
 
-CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
+#CFLAGS = $(WERROR) -Winline -Wall -Wshadow -O -fomit-frame-pointer -g
+CFLAGS = $(WERROR) -Winline -Wall -Wshadow -g
 
 noinst_HEADERS = \
        ansidecl.h     \
index bba3d950963029773a2caf7f52305c43ae68cd67..bfab64d6edbdad9e48213c13220a4d931d785bf6 100644 (file)
@@ -953,6 +953,8 @@ static void emit_jcondshort_delta ( Condcode cond, Int delta )
 
 static void emit_get_eflags ( void )
 {
+  vg_assert(0);
+#if 0
    Int off = 4 * VGOFF_(m_eflags);
    vg_assert(off >= 0 && off < 128);
    newEmit();
@@ -962,10 +964,13 @@ static void emit_get_eflags ( void )
    emitB ( 0x9D ); /* POPFL */
    if (dis)
       VG_(printf)( "\n\t\tpushl %d(%%ebp) ; popfl\n", off );
+#endif
 }
 
 static void emit_put_eflags ( void )
 {
+  vg_assert(0);
+#if 0
    Int off = 4 * VGOFF_(m_eflags);
    vg_assert(off >= 0 && off < 128);
    newEmit();
@@ -975,6 +980,7 @@ static void emit_put_eflags ( void )
    emitB ( off );
    if (dis)
       VG_(printf)( "\n\t\tpushfl ; popl %d(%%ebp)\n", off );
+#endif
 }
 
 static void emit_setb_reg ( Int reg, Condcode cond )
@@ -1587,7 +1593,10 @@ static Int spillOrArchOffset ( Int size, Tag tag, UInt value )
 
 static Int eflagsOffset ( void )
 {
+  vg_assert(0);
+#if 0
    return 4 * VGOFF_(m_eflags);
+#endif
 }
 
 
index 36b295b4aec7989884d87efc941ad7ed017f1fa6..d108667daa4e7e7fea4349e9088b5a3cb9d3a370 100644 (file)
    Basic types
    ------------------------------------------------------------------ */
 
+#if 0
 typedef unsigned char          UChar;
 typedef unsigned short         UShort;
 typedef unsigned int           UInt;
@@ -185,6 +186,13 @@ typedef unsigned int Addr;
 typedef unsigned char Bool;
 #define False ((Bool)0)
 #define True ((Bool)1)
+#endif
+
+#include "../pub/libvex_basictypes.h"
+typedef Addr32  Addr;
+
+
+
 
 #define mycat_wrk(aaa,bbb) aaa##bbb
 #define mycat(aaa,bbb) mycat_wrk(aaa,bbb)
@@ -722,7 +730,12 @@ typedef
       UInt m_edi;
       UInt m_ebp;
       UInt m_esp;
-      UInt m_eflags;
+
+      UInt m_cc_op;
+      UInt m_cc_src;
+      UInt m_cc_dst;
+      UInt m_cc_dflag;
+
       UInt m_eip;
       UInt m_fpu[VG_SIZE_OF_FPUSTATE_W];
 
@@ -1950,10 +1963,16 @@ extern Int VGOFF_(m_esp);
 extern Int VGOFF_(m_ebp);
 extern Int VGOFF_(m_esi);
 extern Int VGOFF_(m_edi);
-extern Int VGOFF_(m_eflags);
+
+extern Int VGOFF_(m_cc_op);
+extern Int VGOFF_(m_cc_src);
+extern Int VGOFF_(m_cc_dst);
+extern Int VGOFF_(m_cc_dflag);
+
 extern Int VGOFF_(m_fpustate);
 extern Int VGOFF_(m_eip);
 
+
 /* Reg-alloc spill area (VG_MAX_SPILLSLOTS words long). */
 extern Int VGOFF_(spillslots);
 
index 66a857e5c8177a6f4901ab5c98d77e887a0f6e8a..f0ebc7ff0a0a66e82a37b4d6ec1c12afe9908d24 100644 (file)
@@ -49,7 +49,12 @@ Int VGOFF_(m_esp) = INVALID_OFFSET;
 Int VGOFF_(m_ebp) = INVALID_OFFSET;
 Int VGOFF_(m_esi) = INVALID_OFFSET;
 Int VGOFF_(m_edi) = INVALID_OFFSET;
-Int VGOFF_(m_eflags) = INVALID_OFFSET;
+
+Int VGOFF_(m_cc_op) = INVALID_OFFSET;
+Int VGOFF_(m_cc_src) = INVALID_OFFSET;
+Int VGOFF_(m_cc_dst) = INVALID_OFFSET;
+Int VGOFF_(m_cc_dflag) = INVALID_OFFSET;
+
 Int VGOFF_(m_fpustate) = INVALID_OFFSET;
 Int VGOFF_(m_eip) = INVALID_OFFSET;
 Int VGOFF_(spillslots) = INVALID_OFFSET;
@@ -159,7 +164,12 @@ static void vg_init_baseBlock ( void )
    /* 5   */ VGOFF_(m_ebp)     = alloc_BaB(1);
    /* 6   */ VGOFF_(m_esi)     = alloc_BaB(1);
    /* 7   */ VGOFF_(m_edi)     = alloc_BaB(1);
-   /* 8   */ VGOFF_(m_eflags)  = alloc_BaB(1);
+
+   /* 8   */ VGOFF_(m_cc_op)  = alloc_BaB(1);
+   /* 8   */ VGOFF_(m_cc_src)  = alloc_BaB(1);
+   /* 8   */ VGOFF_(m_cc_dst)  = alloc_BaB(1);
+   /* 8   */ VGOFF_(m_cc_dflag)  = alloc_BaB(1);
+   /* 25 */  VGOFF_(m_eip) = alloc_BaB(1);
 
    /* 9   */ VGOFF_(sh_eax)    = alloc_BaB(1);
    /* 10  */ VGOFF_(sh_ecx)    = alloc_BaB(1);
@@ -212,9 +222,6 @@ static void vg_init_baseBlock ( void )
    VGOFF_(handle_esp_assignment)
       = alloc_BaB_1_set( (Addr) & VGM_(handle_esp_assignment) );
 
-   /* 25 */
-   VGOFF_(m_eip) = alloc_BaB(1);
-
    /* There are currently 24 spill slots */
    /* 26 .. 49  This overlaps the magic boundary at >= 32 words, but
       most spills are to low numbered spill slots, so the ones above
@@ -822,6 +829,7 @@ static void process_cmd_line_options ( void )
       }
 
       else if (STREQN(15, argv[i], "--suppressions=")) {
+         VG_(printf)("");
          if (VG_(clo_n_suppressions) >= VG_CLO_MAX_SFILES) {
             VG_(message)(Vg_UserMsg, "Too many suppression files specified.");
             VG_(message)(Vg_UserMsg, 
@@ -1006,7 +1014,20 @@ void VG_(copy_baseBlock_to_m_state_static) ( void )
    VG_(m_state_static)[24/4] = VG_(baseBlock)[VGOFF_(m_esi)];
    VG_(m_state_static)[28/4] = VG_(baseBlock)[VGOFF_(m_edi)];
 
-   VG_(m_state_static)[32/4] = VG_(baseBlock)[VGOFF_(m_eflags)];
+   { extern UInt calculate_eflags_all(UInt,UInt,UInt);
+     UInt eflags = calculate_eflags_all(
+                     VG_(baseBlock)[VGOFF_(m_cc_op)],
+                     VG_(baseBlock)[VGOFF_(m_cc_src)],
+                     VG_(baseBlock)[VGOFF_(m_cc_dst)]
+                   );
+     UInt dflag = VG_(baseBlock)[VGOFF_(m_cc_dflag)];
+     vg_assert(dflag == 1 || dflag == 0xFFFFFFFF);
+     if (dflag == 0xFFFFFFFF)
+        eflags |= (1<<10);
+                                                    
+      VG_(m_state_static)[32/4] = eflags;
+   }
+
    VG_(m_state_static)[36/4] = VG_(baseBlock)[VGOFF_(m_eip)];
 
    for (i = 0; i < VG_SIZE_OF_FPUSTATE_W; i++)
@@ -1027,7 +1048,12 @@ void VG_(copy_m_state_static_to_baseBlock) ( void )
    VG_(baseBlock)[VGOFF_(m_esi)] = VG_(m_state_static)[24/4];
    VG_(baseBlock)[VGOFF_(m_edi)] = VG_(m_state_static)[28/4];
 
-   VG_(baseBlock)[VGOFF_(m_eflags)] = VG_(m_state_static)[32/4];
+   //   VG_(baseBlock)[VGOFF_(m_eflags)] = VG_(m_state_static)[32/4];
+   VG_(baseBlock)[VGOFF_(m_cc_op)]    = 0; // CC_OP_COPY
+   VG_(baseBlock)[VGOFF_(m_cc_src)]   = 0;
+   VG_(baseBlock)[VGOFF_(m_cc_dst)]   = 0;
+   VG_(baseBlock)[VGOFF_(m_cc_dflag)] = 0;
+
    VG_(baseBlock)[VGOFF_(m_eip)] = VG_(m_state_static)[36/4];
 
    for (i = 0; i < VG_SIZE_OF_FPUSTATE_W; i++)
index 8690c1b376558669ec4ef1ec3fca4cab4e18285f..593da48ac0539ddecd1fce97e9f0471085c90ed8 100644 (file)
@@ -384,7 +384,12 @@ void VG_(load_thread_state) ( ThreadId tid )
    VG_(baseBlock)[VGOFF_(m_edi)] = VG_(threads)[tid].m_edi;
    VG_(baseBlock)[VGOFF_(m_ebp)] = VG_(threads)[tid].m_ebp;
    VG_(baseBlock)[VGOFF_(m_esp)] = VG_(threads)[tid].m_esp;
-   VG_(baseBlock)[VGOFF_(m_eflags)] = VG_(threads)[tid].m_eflags;
+
+   VG_(baseBlock)[VGOFF_(m_cc_op)]    = VG_(threads)[tid].m_cc_op;
+   VG_(baseBlock)[VGOFF_(m_cc_src)]   = VG_(threads)[tid].m_cc_src;
+   VG_(baseBlock)[VGOFF_(m_cc_dst)]   = VG_(threads)[tid].m_cc_dst;
+   VG_(baseBlock)[VGOFF_(m_cc_dflag)] = VG_(threads)[tid].m_cc_dflag;
+
    VG_(baseBlock)[VGOFF_(m_eip)] = VG_(threads)[tid].m_eip;
 
    for (i = 0; i < VG_SIZE_OF_FPUSTATE_W; i++)
@@ -426,7 +431,12 @@ void VG_(save_thread_state) ( ThreadId tid )
    VG_(threads)[tid].m_edi = VG_(baseBlock)[VGOFF_(m_edi)];
    VG_(threads)[tid].m_ebp = VG_(baseBlock)[VGOFF_(m_ebp)];
    VG_(threads)[tid].m_esp = VG_(baseBlock)[VGOFF_(m_esp)];
-   VG_(threads)[tid].m_eflags = VG_(baseBlock)[VGOFF_(m_eflags)];
+
+   VG_(threads)[tid].m_cc_op    = VG_(baseBlock)[VGOFF_(m_cc_op)];
+   VG_(threads)[tid].m_cc_src   = VG_(baseBlock)[VGOFF_(m_cc_src)];
+   VG_(threads)[tid].m_cc_dst   = VG_(baseBlock)[VGOFF_(m_cc_dst)];
+   VG_(threads)[tid].m_cc_dflag = VG_(baseBlock)[VGOFF_(m_cc_dflag)];
+
    VG_(threads)[tid].m_eip = VG_(baseBlock)[VGOFF_(m_eip)];
 
    for (i = 0; i < VG_SIZE_OF_FPUSTATE_W; i++)
@@ -451,7 +461,10 @@ void VG_(save_thread_state) ( ThreadId tid )
    VG_(baseBlock)[VGOFF_(m_edi)] = junk;
    VG_(baseBlock)[VGOFF_(m_ebp)] = junk;
    VG_(baseBlock)[VGOFF_(m_esp)] = junk;
-   VG_(baseBlock)[VGOFF_(m_eflags)] = junk;
+   VG_(baseBlock)[VGOFF_(m_cc_op)] = junk;
+   VG_(baseBlock)[VGOFF_(m_cc_src)] = junk;
+   VG_(baseBlock)[VGOFF_(m_cc_dst)] = junk;
+   VG_(baseBlock)[VGOFF_(m_cc_dflag)] = junk;
    VG_(baseBlock)[VGOFF_(m_eip)] = junk;
 
    for (i = 0; i < VG_SIZE_OF_FPUSTATE_W; i++)
index 39d365b621a90e33a9ed58b81ec4ade28de75131..dead95e1112892d4049662657b3a908f1f27dfb5 100644 (file)
@@ -909,7 +909,10 @@ typedef
       UInt esi;
       UInt edi;
       Addr eip;
-      UInt eflags;
+      UInt cc_op;
+      UInt cc_src;
+      UInt cc_dst;
+      UInt cc_dflag;
       /* Scheduler-private stuff: what was the thread's status prior to
          delivering this signal? */
       ThreadStatus status;
@@ -980,7 +983,11 @@ void vg_push_signal_frame ( ThreadId tid, int sigNo )
    frame->esi        = tst->m_esi;
    frame->edi        = tst->m_edi;
    frame->eip        = tst->m_eip;
-   frame->eflags     = tst->m_eflags;
+
+   frame->cc_op    = tst->m_cc_op;
+   frame->cc_src   = tst->m_cc_src;
+   frame->cc_dst   = tst->m_cc_dst;
+   frame->cc_dflag = tst->m_cc_dflag;
 
    frame->status     = tst->status;
 
@@ -1051,7 +1058,12 @@ Int vg_pop_signal_frame ( ThreadId tid )
    tst->m_esp     = frame->esp;
    tst->m_esi     = frame->esi;
    tst->m_edi     = frame->edi;
-   tst->m_eflags  = frame->eflags;
+
+   tst->m_cc_op  = frame->cc_op;
+   tst->m_cc_src = frame->cc_src;
+   tst->m_cc_dst = frame->cc_dst;
+   tst->m_cc_dflag = frame->cc_dflag;
+
    tst->m_eip     = frame->eip;
 
    /* don't use the copy exposed to the handler; it might have changed
index 7964f44293010c02b9e54459f4f15bd79ad00b05..dc97b2e547c9fc88b09e617a54a06d2bbf4452b1 100644 (file)
@@ -3078,6 +3078,25 @@ static void vg_cleanup ( UCodeBlock* cb )
 /*--- Main entry point for the JITter.                     ---*/
 /*------------------------------------------------------------*/
 
+#include "../pub/libvex.h"
+
+__attribute__ ((noreturn))
+static
+void failure_exit ( void )
+{
+   VG_(printf)("VEX did failure_exit.  Bye.\n");
+   VG_(exit)(1);
+}
+
+static
+void log_bytes ( Char* bytes, Int nbytes )
+{
+  //fwrite ( bytes, 1, nbytes, stdout );
+  Int i;
+  for (i = 0; i < nbytes; i++) 
+     VG_(printf)("%c", bytes[i]);
+}
+
 /* Translate the basic block beginning at orig_addr, placing the
    translation in a vg_malloc'd block, the address and size of which
    are returned in trans_addr and trans_size.  Length of the original
@@ -3093,6 +3112,44 @@ void VG_(translate) ( ThreadState* tst,
                       Addr* trans_addr,
                       UInt* trans_size )
 {
+#  define N_TMPBUF 1000
+   UChar tmpbuf[N_TMPBUF];
+   Int tmpbuf_used, i;
+   UChar* final;
+
+   TranslateResult tres;
+   static Bool vex_init_done = False;
+
+   if (!vex_init_done) {
+      LibVEX_Init ( &failure_exit, &log_bytes, 
+                    1,  /* debug_paranoia */ 
+                    1,  /* verbosity */
+                    False, 
+                   //True, 
+                    10 );
+      vex_init_done = True;
+   }
+
+   tres = LibVEX_Translate ( 
+             InsnSetX86, InsnSetX86,
+             (Char*)orig_addr, (Addr64)orig_addr, orig_size,
+             tmpbuf, N_TMPBUF, &tmpbuf_used,
+             NULL, NULL
+          );
+
+   vg_assert(tres == TransOK);
+   vg_assert(tmpbuf_used <= N_TMPBUF);
+   vg_assert(tmpbuf_used > 0);
+
+   final = VG_(jitmalloc)( tmpbuf_used );
+   for (i = 0; i < tmpbuf_used; i++)
+      final[i] = tmpbuf[i];
+
+   *trans_addr = (Addr)final;
+   *trans_size = tmpbuf_used;
+
+
+#if 0
    Int         n_disassembled_bytes, final_code_size;
    Bool        debugging_translation;
    UChar*      final_code;
@@ -3204,6 +3261,7 @@ void VG_(translate) ( ThreadState* tst,
       *trans_size = final_code_size;
    }
    VGP_POPCC;
+#endif
 }
 
 /*--------------------------------------------------------------------*/
index 2baa51ce8dfaaf371894a7043235c1cd9f3885dc..ed750d4c63daa3a7181f658a6a4bf4c1fa1cc1f6 100644 (file)
@@ -99,10 +99,6 @@ enum {
     CC_OP_NUMBER
 };
 
-/* called from generated code to evaluate the flags-thunk. */
-extern UInt calculate_c   ( void );
-extern UInt calculate_all ( void );
-
 
 /*---------------------------------------------------------*/
 /*--- Simulated state offsets                           ---*/
@@ -131,7 +127,7 @@ extern UInt calculate_all ( void );
 #define OFFB_EIP     (12*4)
 
 
-#define SIZEOF_X86H_STATE OFFB_EIF
+#define SIZEOF_X86H_STATE OFFB_EIP
 
 
 
index ed25937dd59cef3dd698e23a841e49c8832ce4d6..1007e6bc38e40f8d6a40cdee1ee25a32a9cd5e2a 100644 (file)
@@ -27,7 +27,7 @@
 
 
 /* RUNS AS PART OF GENERATED CODE */
-static UInt calculate_eflags_all ( UInt cc_op, UInt cc_src, UInt cc_dst )
+/*static*/ UInt calculate_eflags_all ( UInt cc_op, UInt cc_src, UInt cc_dst )
 {
    switch (cc_op) {
       default: