]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Improve naming scheme for library-visible fns (infrastructural improvement)
authorJulian Seward <jseward@acm.org>
Mon, 25 Oct 2004 15:33:26 +0000 (15:33 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 25 Oct 2004 15:33:26 +0000 (15:33 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@424

VEX/priv/guest-x86/gdefs.h
VEX/priv/guest-x86/ghelpers.c
VEX/priv/main/vex_main.c
VEX/pub/libvex_guest_x86.h

index a1d84c9e06ca8386d225daa4b4da76bda310a8a1..db5a476fe16997e27d1575a32cb4e0c68ea7bdc5 100644 (file)
@@ -36,6 +36,12 @@ extern
 IRExpr* x86guest_spechelper ( Char* function_name,
                               IRExpr** args );
 
+/* Describes to the optimser which part of the guest state require
+   precise memory exceptions.  This is logically part of the guest
+   state description. */
+extern 
+Bool guest_x86_state_requires_precise_mem_exns ( Int, Int );
+
 
 /*---------------------------------------------------------*/
 /*--- Condition code stuff                              ---*/
index 0a4d9f290471d17642c8b0d4e12ee6d9004a169b..577241f394e1915b44c273e8a1f9a261c6701a4d 100644 (file)
@@ -1238,8 +1238,8 @@ typedef
 
 
 /* VISIBLE TO LIBVEX CLIENT */
-void x87_to_vex ( /*IN*/UChar* x87_state,
-                  /*OUT*/VexGuestX86State* vex_state )
+void LibVEX_GuestX86_put_x87 ( /*IN*/UChar* x87_state,
+                               /*OUT*/VexGuestX86State* vex_state )
 {
    Int        r;
    UInt       tag;
@@ -1277,8 +1277,8 @@ void x87_to_vex ( /*IN*/UChar* x87_state,
 
 
 /* VISIBLE TO LIBVEX CLIENT */
-void vex_to_x87 ( /*IN*/VexGuestX86State* vex_state,
-                  /*OUT*/UChar* x87_state )
+void LibVEX_GuestX86_get_x87 ( /*IN*/VexGuestX86State* vex_state,
+                               /*OUT*/UChar* x87_state )
 {
    Int        i, r;
    UInt       tagw;
@@ -1312,8 +1312,8 @@ void vex_to_x87 ( /*IN*/VexGuestX86State* vex_state,
 
 
 /* VISIBLE TO LIBVEX CLIENT */
-void eflags_to_vex ( UInt eflags_native,
-                     /*OUT*/VexGuestX86State* vex_state )
+void LibVEX_GuestX86_put_eflags ( UInt eflags_native,
+                                  /*OUT*/VexGuestX86State* vex_state )
 {
    vex_state->guest_DFLAG
       = (eflags_native & (1<<10)) ? 0xFFFFFFFF : 0x00000001;
@@ -1330,7 +1330,7 @@ void eflags_to_vex ( UInt eflags_native,
 
 
 /* VISIBLE TO LIBVEX CLIENT */
-UInt vex_to_eflags ( /*IN*/VexGuestX86State* vex_state )
+UInt LibVEX_GuestX86_get_eflags ( /*IN*/VexGuestX86State* vex_state )
 {
    UInt eflags = calculate_eflags_all(
                     vex_state->guest_CC_OP,
@@ -1346,19 +1346,42 @@ UInt vex_to_eflags ( /*IN*/VexGuestX86State* vex_state )
 }
 
 /* VISIBLE TO LIBVEX CLIENT */
-void vex_initialise_x87 ( /* MOD*/VexGuestX86State* vex_state )
+void LibVEX_GuestX86_initialise ( /*OUT*/VexGuestX86State* vex_state )
 {
    Int i;
+
+   vex_state->guest_EAX = 0;
+   vex_state->guest_ECX = 0;
+   vex_state->guest_EDX = 0;
+   vex_state->guest_EBX = 0;
+   vex_state->guest_ESP = 0;
+   vex_state->guest_EBP = 0;
+   vex_state->guest_ESI = 0;
+   vex_state->guest_EDI = 0;
+
+   vex_state->guest_CC_OP  = CC_OP_COPY;
+   vex_state->guest_CC_SRC = 0;
+   vex_state->guest_CC_DST = 0;
+   vex_state->guest_DFLAG  = 1; /* forwards */
+
+   vex_state->guest_EIP = 0;
+
+   vex_state->guest_FTOP = 0;
    for (i = 0; i < 8; i++) {
       vex_state->guest_FPTAG[i] = 0; /* empty */
       vex_state->guest_FPREG[i] = 0; /* IEEE754 64-bit zero */
    }
-   vex_state->guest_FTOP = 0;
-   vex_state->guest_FC3210 = 0;
-
    /* The default setting: all fp exceptions masked, rounding to
       nearest, precision to 64 bits */
    vex_state->guest_FPUCW = 0x03F7; 
+   vex_state->guest_FC3210 = 0;
+
+   vex_state->guest_CS = 0;
+   vex_state->guest_DS = 0;
+   vex_state->guest_ES = 0;
+   vex_state->guest_FS = 0;
+   vex_state->guest_GS = 0;
+   vex_state->guest_SS = 0;
 }
 
 
index 878224bac94b0b06883f2ffac5d1677454f3c3f1..a9861463cc93534d9efe64bdd94c237bafccbb25 100644 (file)
@@ -7,7 +7,6 @@
 /*---------------------------------------------------------------*/
 
 #include "libvex.h"
-#include "libvex_guest_x86.h"
 
 #include "main/vex_globals.h"
 #include "main/vex_util.h"
index 72a03e4e5f31b068458464ad99dd427d0f98b1bf..0afaf3ef8cda4fe85bc1ac8934f9aff315fb273b 100644 (file)
@@ -106,34 +106,33 @@ typedef
    VexGuestX86State;
 
 
-/* This is logically part of the guest state description. */
-/* Not visible to library client. */
-extern Bool guest_x86_state_requires_precise_mem_exns ( Int, Int );
-
-
 
 /*---------------------------------------------------------------*/
 /*--- Utility functions for x86 guest stuff.                  ---*/
 /*---------------------------------------------------------------*/
 
 
+/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
 
 
-/* ALL THE FOLLOWING ARE VISIBLE TO LIBRARY CLIENT */
+/* Initialise all guest x86 state.  The FPU is put in default mode. */
+extern
+void LibVEX_GuestX86_initialise ( /*OUT*/VexGuestX86State* vex_state );
+
 
 /* Convert a saved x87 FPU image (as created by fsave) and write it
    into the supplied VexGuestX86State structure.  The non-FP parts of
    said structure are left unchanged.  
 */
 extern 
-void x87_to_vex ( /*IN*/UChar* x87_state, 
-                  /*OUT*/VexGuestX86State* vex_state );
+void LibVEX_GuestX86_put_x87 ( /*IN*/UChar* x87_state, 
+                               /*OUT*/VexGuestX86State* vex_state );
 
 /* Extract from the supplied VexGuestX86State structure, an x87 FPU
    image. */
 extern 
-void vex_to_x87 ( /*IN*/VexGuestX86State* vex_state, 
-                  /*OUT*/UChar* x87_state );
+void LibVEX_GuestX86_get_x87 ( /*IN*/VexGuestX86State* vex_state, 
+                               /*OUT*/UChar* x87_state );
 
 
 /* Given a 32-bit word containing native x86 %eflags values, set the
@@ -141,17 +140,15 @@ void vex_to_x87 ( /*IN*/VexGuestX86State* vex_state,
    All other fields are left unchanged.  */
 
 extern
-void eflags_to_vex ( UInt eflags_native,
-                     /*OUT*/VexGuestX86State* vex_state );
+void LibVEX_GuestX86_put_eflags ( UInt eflags_native,
+                                  /*OUT*/VexGuestX86State* vex_state );
 
 /* Extract from the supplied VexGuestX86State structure the
    corresponding native %eflags value. */
 
 extern 
-UInt vex_to_eflags ( /*IN*/VexGuestX86State* vex_state );
+UInt LibVEX_GuestX86_get_eflags ( /*IN*/VexGuestX86State* vex_state );
 
-extern
-void vex_initialise_x87 ( /* MOD*/VexGuestX86State* vex_state );
 
 #endif /* ndef __LIBVEX_PUB_GUEST_X86_H */