]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a function to set/clear the x86 carry flag. (untested)
authorJulian Seward <jseward@acm.org>
Mon, 20 Mar 2006 12:05:42 +0000 (12:05 +0000)
committerJulian Seward <jseward@acm.org>
Mon, 20 Mar 2006 12:05:42 +0000 (12:05 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@1601

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

index 8921331b34aa8f3b25d471fcef71f853ad1abfee..e27223da50076390be92df70ec817d797ed28de8 100644 (file)
@@ -743,6 +743,28 @@ UInt LibVEX_GuestX86_get_eflags ( /*IN*/VexGuestX86State* vex_state )
    return eflags;
 }
 
+/* VISIBLE TO LIBVEX CLIENT */
+void
+LibVEX_GuestX86_put_eflag_c ( UInt new_carry_flag,
+                              /*MOD*/VexGuestX86State* vex_state )
+{
+   UInt oszacp = x86g_calculate_eflags_all_WRK(
+                    vex_state->guest_CC_OP,
+                    vex_state->guest_CC_DEP1,
+                    vex_state->guest_CC_DEP2,
+                    vex_state->guest_CC_NDEP
+                 );
+   if (new_carry_flag & 1) {
+      oszacp |= X86G_CC_MASK_C;
+   } else {
+      oszacp &= ~X86G_CC_MASK_C;
+   }
+   vex_state->guest_CC_OP   = X86G_CC_OP_COPY;
+   vex_state->guest_CC_DEP1 = oszacp;
+   vex_state->guest_CC_DEP2 = 0;
+   vex_state->guest_CC_NDEP = 0;
+}
+
 
 /*---------------------------------------------------------------*/
 /*--- %eflags translation-time function specialisers.         ---*/
index e78afd3bda0766c4de8509dd35fb2c03093c8136..94d3736850a4da272006b8622cb7943a2ddb107b 100644 (file)
@@ -279,7 +279,12 @@ void LibVEX_GuestX86_initialise ( /*OUT*/VexGuestX86State* vex_state );
 extern 
 UInt LibVEX_GuestX86_get_eflags ( /*IN*/VexGuestX86State* vex_state );
 
-
+/* Set the carry flag in the given state to 'new_carry_flag', which
+   should be zero or one. */
+extern
+void
+LibVEX_GuestX86_put_eflag_c ( UInt new_carry_flag,
+                              /*MOD*/VexGuestX86State* vex_state );
 
 #endif /* ndef __LIBVEX_PUB_GUEST_X86_H */