]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Make the 1.0.4 testbed work again.
authorJulian Seward <jseward@acm.org>
Fri, 5 Nov 2004 20:14:54 +0000 (20:14 +0000)
committerJulian Seward <jseward@acm.org>
Fri, 5 Nov 2004 20:14:54 +0000 (20:14 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@498

VEX/hacked104/vg_main.c
VEX/hacked104/vg_translate.c

index c979dc5857ae77ff03bf61148ec0dcb4aae414a7..a65af8ee6e97e27113a460f2afb9839d1d7bf4d7 100644 (file)
@@ -140,6 +140,7 @@ static Int alloc_BaB_1_set ( Addr a )
 static void vg_init_baseBlock ( void )
 {
    baB_off = 0;
+   Int shadow;
 
    /* Those with offsets under 128 are carefully chosen. */
 
@@ -149,6 +150,18 @@ static void vg_init_baseBlock ( void )
    VGOFF_(m_vex)  = alloc_BaB( (3 + sizeof(VexGuestX86State)) / 4 );
    VGOFF_(m_eipS) = VGOFF_(m_vex) + offsetof(VexGuestX86State,guest_EIP)/4;
 
+   /* Now a lump of shadow state. */
+   shadow = alloc_BaB( (3 + sizeof(VexGuestX86State)) / 4 );
+
+   /* Now the spill area. */
+   VGOFF_(spillslots) = alloc_BaB(LibVEX_N_SPILL_BYTES/4);
+   VG_(printf)("1.0.4:  state at %d\n", 4* VGOFF_(m_vex));
+   VG_(printf)("1.0.4:  spill at %d\n", 4* VGOFF_(spillslots));
+   VG_(printf)("1.0.4: shadow at %d\n", 4* shadow );
+
+   LibVEX_GuestX86_initialise( (VexGuestX86State*)
+                               & VG_(baseBlock)[ VGOFF_(m_vex) ] );
+
 #undef offsetof
 
    /* 34  */ VGOFF_(sh_eax)    = alloc_BaB(1);
@@ -207,8 +220,6 @@ static void vg_init_baseBlock ( void )
    /* 55 .. 155  This overlaps the magic boundary at >= 32 words, but
       most spills are to low numbered spill slots, so the ones above
       the boundary don't see much action. */
-   VGOFF_(spillslots) = alloc_BaB(VG_MAX_SPILLSLOTS);
-   VG_(printf)("1.0.4 spillslots: start at word %d\n", VGOFF_(spillslots));
    /* These two pushed beyond the boundary because 2-byte transactions
       are rare. */
    /* 50  */
@@ -993,9 +1004,9 @@ void VG_(copy_baseBlock_to_m_state_static) ( void )
    VG_(m_state_static)[20/4] = vex->guest_EBP;
    VG_(m_state_static)[24/4] = vex->guest_ESI;
    VG_(m_state_static)[28/4] = vex->guest_EDI;
-   VG_(m_state_static)[32/4] = vex_to_eflags( vex );
+   VG_(m_state_static)[32/4] = LibVEX_GuestX86_get_eflags( vex );
    VG_(m_state_static)[36/4] = vex->guest_EIP;
-   vex_to_x87( vex, (UChar*)&VG_(m_state_static)[40/4] );
+   LibVEX_GuestX86_get_x87( vex, (UChar*)&VG_(m_state_static)[40/4] );
 }
 
 
@@ -1011,9 +1022,9 @@ void VG_(copy_m_state_static_to_baseBlock) ( void )
    vex->guest_EBP = VG_(m_state_static)[20/4];
    vex->guest_ESI = VG_(m_state_static)[24/4];
    vex->guest_EDI = VG_(m_state_static)[28/4];
-   eflags_to_vex( VG_(m_state_static)[32/4], vex );
+   LibVEX_GuestX86_put_eflags( VG_(m_state_static)[32/4], vex );
    vex->guest_EIP = VG_(m_state_static)[36/4];
-   x87_to_vex( (UChar*)&VG_(m_state_static)[40/4], vex );
+   LibVEX_GuestX86_put_x87( (UChar*)&VG_(m_state_static)[40/4], vex );
 }
 
 
index 33aa221b49da10a451c538856233d83fbbd79ff3..9337660839ee98f670b5ba3ad940f0ee74bc801a 100644 (file)
@@ -3128,12 +3128,12 @@ void VG_(translate) ( ThreadState* tst,
    static Bool vex_init_done = False;
 
    if (!vex_init_done) {
+      VexControl vcon;
+      LibVEX_default_VexControl( &vcon );
       LibVEX_Init ( &failure_exit, &log_bytes, 
                     1,  /* debug_paranoia */ 
-                    0,  /* verbosity */
-                    False, 
-                   //True, 
-                    50 /* max insns per bb */ );
+                    False,
+                    &vcon );
       vex_init_done = True;
    }
 
@@ -3160,11 +3160,17 @@ void VG_(translate) ( ThreadState* tst,
    }
 
    tres = LibVEX_Translate ( 
-             InsnSetX86, InsnSetX86,
-             (Char*)orig_addr, (Addr64)orig_addr, &t_orig_size,
-             tmpbuf, N_TMPBUF, &tmpbuf_used,
-             NULL, NULL,
-             debugging_translation ? 2 :
+             InsnSetX86, 
+             InsnSetX86,
+             (Char*)orig_addr, 
+             (Addr64)orig_addr, 
+             &t_orig_size,
+             tmpbuf, 
+             N_TMPBUF, 
+             &tmpbuf_used,
+             NULL, NULL, False,
+             NULL,
+             debugging_translation ? ((1<<7)) :
                 (VG_(overall_in_count) > v2thresh ? 2 : 0)
           );
 
@@ -3196,118 +3202,6 @@ void VG_(translate) ( ThreadState* tst,
       *trans_size = tmpbuf_used;
    }
 
-
-#if 0
-   Int         n_disassembled_bytes, final_code_size;
-   Bool        debugging_translation;
-   UChar*      final_code;
-   UCodeBlock* cb;
-
-   VGP_PUSHCC(VgpTranslate);
-
-   dis = True;
-   dis = debugging_translation;
-
-   /* Check if we're being asked to jump to a silly address, and if so
-      record an error message before potentially crashing the entire
-      system. */
-   if (VG_(clo_instrument) && !debugging_translation && !dis) {
-      Addr bad_addr;
-      Bool ok = VGM_(check_readable) ( orig_addr, 1, &bad_addr );
-      if (!ok) {
-         VG_(record_jump_error)(tst, bad_addr);
-      }
-   }
-
-   /* if (VG_(overall_in_count) >= 4800) dis=True; */
-   if (VG_(disassemble))
-      VG_(printf)("\n");
-   if (0 || dis 
-       || (VG_(overall_in_count) > 0 &&
-           (VG_(overall_in_count) % 1000 == 0))) {
-      if (0&& (VG_(clo_verbosity) > 1 || dis))
-         VG_(message)(Vg_UserMsg,
-              "trans# %d, bb# %lu, in %d, out %d",
-              VG_(overall_in_count), 
-              VG_(bbs_done),
-              VG_(overall_in_osize), VG_(overall_in_tsize) );
-   }
-   cb = VG_(allocCodeBlock)();
-
-   /* Disassemble this basic block into cb. */
-   //dis=True;
-   /* VGP_PUSHCC(VgpToUCode); */
-   n_disassembled_bytes = VG_(disBB) ( cb, orig_addr );
-   /* VGP_POPCC; */
-   //dis=False;
-   /* if (0&& VG_(translations_done) < 617)  */
-   /*    dis=False; */
-   /* Try and improve the code a bit. */
-   if (VG_(clo_optimise)) {
-      /* VGP_PUSHCC(VgpImprove); */
-      vg_improve ( cb );
-      if (VG_(disassemble)) 
-         VG_(ppUCodeBlock) ( cb, "Improved code:" );
-      /* VGP_POPCC; */
-   }
-   //dis = True;
-   /* Add instrumentation code. */
-   if (VG_(clo_instrument)) {
-      /* VGP_PUSHCC(VgpInstrument); */
-      cb = vg_instrument(cb);
-      /* VGP_POPCC; */
-      if (VG_(disassemble)) 
-         VG_(ppUCodeBlock) ( cb, "Instrumented code:" );
-      if (VG_(clo_cleanup)) {
-         /* VGP_PUSHCC(VgpCleanup); */
-         vg_cleanup(cb);
-         /* VGP_POPCC; */
-         if (VG_(disassemble)) 
-            VG_(ppUCodeBlock) ( cb, "Cleaned-up instrumented code:" );
-      }
-   }
-   //dis = False;
-
-   //dis = True;
-   /* Add cache simulation code. */
-   if (VG_(clo_cachesim)) {
-      /* VGP_PUSHCC(VgpCacheInstrument); */
-      cb = VG_(cachesim_instrument)(cb, orig_addr);
-      /* VGP_POPCC; */
-      if (VG_(disassemble)) 
-         VG_(ppUCodeBlock) ( cb, "Cachesim instrumented code:" );
-   }
-   //dis = False;
-   
-   /* Allocate registers. */
-   //dis = True;
-   /* VGP_PUSHCC(VgpRegAlloc); */
-   cb = vg_do_register_allocation ( cb );
-   /* VGP_POPCC; */
-   //dis = False;
-   /* 
-   if (VG_(disassemble))
-      VG_(ppUCodeBlock) ( cb, "After Register Allocation:");
-   */
-
-   /* VGP_PUSHCC(VgpFromUcode); */
-   /* NB final_code is allocated with VG_(jitmalloc), not VG_(malloc)
-      and so must be VG_(jitfree)'d. */
-   final_code = VG_(emit_code)(cb, &final_code_size );
-   /* VGP_POPCC; */
-   VG_(freeCodeBlock)(cb);
-
-   if (debugging_translation) {
-      /* Only done for debugging -- throw away final result. */
-      VG_(jitfree)(final_code);
-   } else {
-      /* Doing it for real -- return values to caller. */
-      *orig_size = n_disassembled_bytes;
-      *trans_addr = (Addr)final_code;
-      *trans_size = final_code_size;
-   }
-   VGP_POPCC;
-#endif
 }
 
 /*--------------------------------------------------------------------*/