extern
IRBB* bbToIR_AMD64 ( UChar* amd64code,
- Addr64 eip,
+ Addr64 guest_rip_start,
VexGuestExtents* vge,
Bool (*byte_accessible)(Addr64),
Bool (*resteerOkFn)(Addr64),
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
);
#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 */
//..
//.. 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 ---*/
//.. /*------------------------------------------------------------*/
//.. /*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;
#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"
#include "host-x86/hdefs.h"
#include "guest-x86/gdefs.h"
+#include "guest-amd64/gdefs.h"
#include "guest-arm/gdefs.h"
|| 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;
guest_sizeB = sizeof(VexGuestARMState);
guest_word_type = Ity_I32;
guest_layout = &armGuest_layout;
+ vassert(subarch_guest == VexSubArchARM_v4);
break;
default: