From: Julian Seward Date: Sun, 25 Jul 2004 00:07:35 +0000 (+0000) Subject: Integration stuff to make the 104 testbed work. X-Git-Tag: svn/VALGRIND_3_0_1^2~1217 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a328a953267fced5a1d88663ffcf732f4d4f8a4a;p=thirdparty%2Fvalgrind.git Integration stuff to make the 104 testbed work. git-svn-id: svn://svn.valgrind.org/vex/trunk@117 --- diff --git a/VEX/Makefile b/VEX/Makefile index d102ae15c3..f4a04fcec8 100644 --- a/VEX/Makefile +++ b/VEX/Makefile @@ -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) diff --git a/VEX/hacked104/Makefile.am b/VEX/hacked104/Makefile.am index 7211b8bfba..e2a147fa47 100644 --- a/VEX/hacked104/Makefile.am +++ b/VEX/hacked104/Makefile.am @@ -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 diff --git a/VEX/hacked104/Makefile.in b/VEX/hacked104/Makefile.in index 761dd134e1..a63fbd3780 100644 --- a/VEX/hacked104/Makefile.in +++ b/VEX/hacked104/Makefile.in @@ -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) diff --git a/VEX/hacked104/default.supp b/VEX/hacked104/default.supp index 7b913c2ff3..c9f6a15e2e 100644 --- a/VEX/hacked104/default.supp +++ b/VEX/hacked104/default.supp @@ -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 # @@ -366,6 +366,109 @@ ##----------------------------------------------------------------------## +##----------------------------------------------------------------------## + +# 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) @@ -511,106 +614,3 @@ ##----------------------------------------------------------------------## - -##----------------------------------------------------------------------## - -# 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 -} - - -##----------------------------------------------------------------------## - diff --git a/VEX/hacked104/demangle/Makefile.in b/VEX/hacked104/demangle/Makefile.in index 71a1c272d0..47e07b3106 100644 --- a/VEX/hacked104/demangle/Makefile.in +++ b/VEX/hacked104/demangle/Makefile.in @@ -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 \ diff --git a/VEX/hacked104/vg_from_ucode.c b/VEX/hacked104/vg_from_ucode.c index bba3d95096..bfab64d6ed 100644 --- a/VEX/hacked104/vg_from_ucode.c +++ b/VEX/hacked104/vg_from_ucode.c @@ -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 } diff --git a/VEX/hacked104/vg_include.h b/VEX/hacked104/vg_include.h index 36b295b4ae..d108667daa 100644 --- a/VEX/hacked104/vg_include.h +++ b/VEX/hacked104/vg_include.h @@ -170,6 +170,7 @@ 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); diff --git a/VEX/hacked104/vg_main.c b/VEX/hacked104/vg_main.c index 66a857e5c8..f0ebc7ff0a 100644 --- a/VEX/hacked104/vg_main.c +++ b/VEX/hacked104/vg_main.c @@ -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++) diff --git a/VEX/hacked104/vg_scheduler.c b/VEX/hacked104/vg_scheduler.c index 8690c1b376..593da48ac0 100644 --- a/VEX/hacked104/vg_scheduler.c +++ b/VEX/hacked104/vg_scheduler.c @@ -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++) diff --git a/VEX/hacked104/vg_signals.c b/VEX/hacked104/vg_signals.c index 39d365b621..dead95e111 100644 --- a/VEX/hacked104/vg_signals.c +++ b/VEX/hacked104/vg_signals.c @@ -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 diff --git a/VEX/hacked104/vg_translate.c b/VEX/hacked104/vg_translate.c index 7964f44293..dc97b2e547 100644 --- a/VEX/hacked104/vg_translate.c +++ b/VEX/hacked104/vg_translate.c @@ -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 } /*--------------------------------------------------------------------*/ diff --git a/VEX/priv/guest-x86/x86guest_defs.h b/VEX/priv/guest-x86/x86guest_defs.h index 2baa51ce8d..ed750d4c63 100644 --- a/VEX/priv/guest-x86/x86guest_defs.h +++ b/VEX/priv/guest-x86/x86guest_defs.h @@ -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 diff --git a/VEX/priv/guest-x86/x86helpers.c b/VEX/priv/guest-x86/x86helpers.c index ed25937dd5..1007e6bc38 100644 --- a/VEX/priv/guest-x86/x86helpers.c +++ b/VEX/priv/guest-x86/x86helpers.c @@ -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: