From: Julian Seward Date: Thu, 20 Jan 2005 20:26:33 +0000 (+0000) Subject: Add stub definitions for amd64 front end functions. X-Git-Tag: svn/VALGRIND_3_0_1^2~603 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=987261b200fa6873b4aa498c9f51255b4e5948f0;p=thirdparty%2Fvalgrind.git Add stub definitions for amd64 front end functions. git-svn-id: svn://svn.valgrind.org/vex/trunk@731 --- diff --git a/VEX/priv/guest-amd64/gdefs.h b/VEX/priv/guest-amd64/gdefs.h index bee00ee48e..190ddcfe94 100644 --- a/VEX/priv/guest-amd64/gdefs.h +++ b/VEX/priv/guest-amd64/gdefs.h @@ -45,7 +45,7 @@ extern IRBB* bbToIR_AMD64 ( UChar* amd64code, - Addr64 eip, + Addr64 guest_rip_start, VexGuestExtents* vge, Bool (*byte_accessible)(Addr64), Bool (*resteerOkFn)(Addr64), @@ -78,7 +78,7 @@ extern ULong amd64g_calculate_rflags_all ( ULong cc_dep1, ULong cc_dep2, ULong cc_ndep ); -extern Ulong amd64g_calculate_eflags_c ( +extern ULong amd64g_calculate_eflags_c ( ULong cc_op, ULong cc_dep1, ULong cc_dep2, ULong cc_ndep ); diff --git a/VEX/priv/guest-amd64/ghelpers.c b/VEX/priv/guest-amd64/ghelpers.c index cca2764a08..e15c791606 100644 --- a/VEX/priv/guest-amd64/ghelpers.c +++ b/VEX/priv/guest-amd64/ghelpers.c @@ -40,7 +40,71 @@ #include "libvex.h" #include "main/vex_util.h" -//#include "guest-amd64/gdefs.h" // put back in when that file is added +#include "guest-amd64/gdefs.h" + + + +IRExpr* guest_amd64_spechelper ( Char* function_name, + IRExpr** args ) +{ + vassert(0); + return NULL; +} + +Bool guest_amd64_state_requires_precise_mem_exns ( Int minoff, + Int maxoff) +{ + vassert(0); + return False; +} +#define ALWAYSDEFD(field) \ + { offsetof(VexGuestX86State, field), \ + (sizeof ((VexGuestX86State*)0)->field) } + +VexGuestLayout +amd64guest_layout; +#if 0 + = { + /* Total size of the guest state, in bytes. */ + .total_sizeB = sizeof(VexGuestX86State), + + /* Describe the stack pointer. */ + .offset_SP = offsetof(VexGuestX86State,guest_ESP), + .sizeof_SP = 4, + + /* Describe the instruction pointer. */ + .offset_IP = offsetof(VexGuestX86State,guest_EIP), + .sizeof_IP = 4, + + /* Describe any sections to be regarded by Memcheck as + 'always-defined'. */ + .n_alwaysDefd = 18, + + /* flags thunk: OP and NDEP are always defd, whereas DEP1 + and DEP2 have to be tracked. See detailed comment in + gdefs.h on meaning of thunk fields. */ + .alwaysDefd + = { /* 0 */ ALWAYSDEFD(guest_CC_OP), + /* 1 */ ALWAYSDEFD(guest_CC_NDEP), + /* 2 */ ALWAYSDEFD(guest_DFLAG), + /* 3 */ ALWAYSDEFD(guest_IDFLAG), + /* 4 */ ALWAYSDEFD(guest_EIP), + /* 5 */ ALWAYSDEFD(guest_FTOP), + /* 6 */ ALWAYSDEFD(guest_FPTAG), + /* 7 */ ALWAYSDEFD(guest_FPROUND), + /* 8 */ ALWAYSDEFD(guest_FC3210), + /* 9 */ ALWAYSDEFD(guest_CS), + /* 10 */ ALWAYSDEFD(guest_DS), + /* 11 */ ALWAYSDEFD(guest_ES), + /* 12 */ ALWAYSDEFD(guest_FS), + /* 13 */ ALWAYSDEFD(guest_GS), + /* 14 */ ALWAYSDEFD(guest_SS), + /* 15 */ ALWAYSDEFD(guest_LDT), + /* 16 */ ALWAYSDEFD(guest_GDT), + /* 17 */ ALWAYSDEFD(guest_EMWARN) + } + }; +#endif /* VISIBLE TO LIBVEX CLIENT */ diff --git a/VEX/priv/guest-amd64/toIR.c b/VEX/priv/guest-amd64/toIR.c index 38c9e0c3e6..12d2a6803c 100644 --- a/VEX/priv/guest-amd64/toIR.c +++ b/VEX/priv/guest-amd64/toIR.c @@ -73,19 +73,19 @@ //.. //.. This module uses global variables and so is not MT-safe (if that //.. should ever become relevant). */ -//.. -//.. /* Translates AMD64 code to IR. */ -//.. -//.. #include "libvex_basictypes.h" -//.. #include "libvex_ir.h" -//.. #include "libvex.h" -//.. #include "libvex_guest_amd64.h" -//.. -//.. #include "main/vex_util.h" -//.. #include "main/vex_globals.h" -//.. #include "guest-amd64/gdefs.h" -//.. -//.. + +/* Translates AMD64 code to IR. */ + +#include "libvex_basictypes.h" +#include "libvex_ir.h" +#include "libvex.h" +#include "libvex_guest_amd64.h" + +#include "main/vex_util.h" +#include "main/vex_globals.h" +#include "guest-amd64/gdefs.h" + + //.. /*------------------------------------------------------------*/ //.. /*--- Globals ---*/ //.. /*------------------------------------------------------------*/ @@ -220,21 +220,23 @@ //.. /*IN*/ VexSubArch subarch, //.. /*OUT*/ UInt* size, //.. /*OUT*/ Addr64* whereNext ); -//.. -//.. -//.. /* This is the main (only, in fact) entry point for this module. */ -//.. -//.. /* Disassemble a complete basic block, starting at eip, and dumping -//.. the ucode into cb. Returns the size, in bytes, of the basic -//.. block. */ -//.. IRBB* bbToIR_X86 ( UChar* x86code, -//.. Addr64 guest_eip_start, -//.. VexGuestExtents* vge, -//.. Bool (*byte_accessible)(Addr64), -//.. Bool (*chase_into_ok)(Addr64), -//.. Bool host_bigendian, -//.. VexSubArch subarch_guest ) -//.. { + + +/* This is the main (only, in fact) entry point for this module. */ + +/* Disassemble a complete basic block, starting at eip, and dumping + the ucode into cb. Returns the size, in bytes, of the basic + block. */ +IRBB* bbToIR_AMD64 ( UChar* amd64code, + Addr64 guest_rip_start, + VexGuestExtents* vge, + Bool (*byte_accessible)(Addr64), + Bool (*chase_into_ok)(Addr64), + Bool host_bigendian, + VexSubArch subarch_guest ) +{ + vassert(0); +} //.. UInt delta; //.. Int i, n_instrs, size, first_stmt_idx; //.. Addr64 guest_next; diff --git a/VEX/priv/main/vex_main.c b/VEX/priv/main/vex_main.c index c8feac46d3..fcde08143b 100644 --- a/VEX/priv/main/vex_main.c +++ b/VEX/priv/main/vex_main.c @@ -36,6 +36,7 @@ #include "libvex.h" #include "libvex_emwarn.h" #include "libvex_guest_x86.h" +#include "libvex_guest_amd64.h" #include "libvex_guest_arm.h" #include "main/vex_globals.h" @@ -46,6 +47,7 @@ #include "host-x86/hdefs.h" #include "guest-x86/gdefs.h" +#include "guest-amd64/gdefs.h" #include "guest-arm/gdefs.h" @@ -280,6 +282,16 @@ VexTranslateResult LibVEX_Translate ( || subarch_guest == VexSubArchX86_sse2); break; + case VexArchAMD64: + preciseMemExnsFn = guest_amd64_state_requires_precise_mem_exns; + bbToIR = bbToIR_AMD64; + specHelper = guest_amd64_spechelper; + guest_sizeB = sizeof(VexGuestAMD64State); + guest_word_type = Ity_I64; + guest_layout = &amd64guest_layout; + vassert(subarch_guest == VexSubArch_NONE); + break; + case VexArchARM: preciseMemExnsFn = guest_arm_state_requires_precise_mem_exns; bbToIR = bbToIR_ARM; @@ -287,6 +299,7 @@ VexTranslateResult LibVEX_Translate ( guest_sizeB = sizeof(VexGuestARMState); guest_word_type = Ity_I32; guest_layout = &armGuest_layout; + vassert(subarch_guest == VexSubArchARM_v4); break; default: