# 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
clean:
rm -f $(APP_OBJS) $(LIB_OBJS) libvex.a vex
-
+ (cd hacked104 && make clean)
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
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
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)
# 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
-}
-
-
-##----------------------------------------------------------------------##
-
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 \
static void emit_get_eflags ( void )
{
+ vg_assert(0);
+#if 0
Int off = 4 * VGOFF_(m_eflags);
vg_assert(off >= 0 && off < 128);
newEmit();
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();
emitB ( off );
if (dis)
VG_(printf)( "\n\t\tpushfl ; popl %d(%%ebp)\n", off );
+#endif
}
static void emit_setb_reg ( Int reg, Condcode cond )
static Int eflagsOffset ( void )
{
+ vg_assert(0);
+#if 0
return 4 * VGOFF_(m_eflags);
+#endif
}
Basic types
------------------------------------------------------------------ */
+#if 0
typedef unsigned char UChar;
typedef unsigned short UShort;
typedef unsigned int UInt;
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)
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];
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);
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;
/* 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);
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
}
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,
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++)
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++)
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++)
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++)
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++)
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;
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;
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
/*--- 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
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;
*trans_size = final_code_size;
}
VGP_POPCC;
+#endif
}
/*--------------------------------------------------------------------*/
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 ---*/
#define OFFB_EIP (12*4)
-#define SIZEOF_X86H_STATE OFFB_EIF
+#define SIZEOF_X86H_STATE OFFB_EIP
/* 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: