|
From: <sv...@va...> - 2006-03-20 12:05:48
|
Author: sewardj
Date: 2006-03-20 12:05:42 +0000 (Mon, 20 Mar 2006)
New Revision: 1601
Log:
Add a function to set/clear the x86 carry flag. (untested)
Modified:
trunk/priv/guest-x86/ghelpers.c
trunk/pub/libvex_guest_x86.h
Modified: trunk/priv/guest-x86/ghelpers.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/priv/guest-x86/ghelpers.c 2006-03-18 11:29:25 UTC (rev 1600)
+++ trunk/priv/guest-x86/ghelpers.c 2006-03-20 12:05:42 UTC (rev 1601)
@@ -743,7 +743,29 @@
return eflags;
}
=20
+/* VISIBLE TO LIBVEX CLIENT */
+void
+LibVEX_GuestX86_put_eflag_c ( UInt new_carry_flag,
+ /*MOD*/VexGuestX86State* vex_state )
+{
+ UInt oszacp =3D 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 |=3D X86G_CC_MASK_C;
+ } else {
+ oszacp &=3D ~X86G_CC_MASK_C;
+ }
+ vex_state->guest_CC_OP =3D X86G_CC_OP_COPY;
+ vex_state->guest_CC_DEP1 =3D oszacp;
+ vex_state->guest_CC_DEP2 =3D 0;
+ vex_state->guest_CC_NDEP =3D 0;
+}
=20
+
/*---------------------------------------------------------------*/
/*--- %eflags translation-time function specialisers. ---*/
/*--- These help iropt specialise calls the above run-time ---*/
Modified: trunk/pub/libvex_guest_x86.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
--- trunk/pub/libvex_guest_x86.h 2006-03-18 11:29:25 UTC (rev 1600)
+++ trunk/pub/libvex_guest_x86.h 2006-03-20 12:05:42 UTC (rev 1601)
@@ -279,8 +279,13 @@
extern=20
UInt LibVEX_GuestX86_get_eflags ( /*IN*/VexGuestX86State* vex_state );
=20
+/* 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 );
=20
-
#endif /* ndef __LIBVEX_PUB_GUEST_X86_H */
=20
/*---------------------------------------------------------------*/
|