]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add stub definitions for amd64 front end functions.
authorJulian Seward <jseward@acm.org>
Thu, 20 Jan 2005 20:26:33 +0000 (20:26 +0000)
committerJulian Seward <jseward@acm.org>
Thu, 20 Jan 2005 20:26:33 +0000 (20:26 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@731

VEX/priv/guest-amd64/gdefs.h
VEX/priv/guest-amd64/ghelpers.c
VEX/priv/guest-amd64/toIR.c
VEX/priv/main/vex_main.c

index bee00ee48e5497d99aef35ac9f7a29cdab501310..190ddcfe94ee70e12a71a73477207db0926a5aeb 100644 (file)
@@ -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 
              );
index cca2764a0879da28a741f5983a5d01e436f0e569..e15c7916061caace44dc87832d62f83f5662447b 100644 (file)
 #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 */
index 38c9e0c3e6bb516d6a46c3c8727399de6004d7e5..12d2a6803ca60c28917cc8d34736f7ce2913d1fd 100644 (file)
 //.. 
 //..    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;
index c8feac46d33784d8f338bfdec56d7dfb17bdeb39..fcde08143b1588cf80411a308f81b8ae73de1903 100644 (file)
@@ -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: