]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Add a few more flag evaluation routines.
authorJulian Seward <jseward@acm.org>
Sun, 25 Jul 2004 17:25:55 +0000 (17:25 +0000)
committerJulian Seward <jseward@acm.org>
Sun, 25 Jul 2004 17:25:55 +0000 (17:25 +0000)
git-svn-id: svn://svn.valgrind.org/vex/trunk@121

VEX/priv/guest-x86/x86guest_defs.h
VEX/priv/guest-x86/x86helpers.c

index d1ba7d6d59ad4fe0cb1c0a3fa037d42998799657..7d8d76c2bbe06222a027a27fb1dbd9b626c199e5 100644 (file)
@@ -62,11 +62,11 @@ enum {
 
     CC_OP_SBBB, /* modify all flags, CC_DST = res, CC_SRC = src1 */
     CC_OP_SBBW,
-    CC_OP_SBBL,
+    CC_OP_SBBL, /* 12 */
 
     CC_OP_LOGICB, /* modify all flags, CC_DST = res */
     CC_OP_LOGICW,
-    CC_OP_LOGICL,
+    CC_OP_LOGICL, /* 15 */
 
     CC_OP_INCB, /* modify all flags except, CC_DST = res, CC_SRC = C */
     CC_OP_INCW,
index e2e06dfa72af57f80af07aa9f6e870578fe428be..badce8f2fd1be078c6fbb806f9dc727906539ffc 100644 (file)
@@ -99,13 +99,29 @@ static inline int lshift(int x, int n)
       return cf | pf | af | zf | sf | of;                                 \
    }
 
+#define ACTIONS_LOGIC(DATA_BITS,DATA_TYPE,DATA_STYPE)  \
+   {                                                   \
+      PREAMBLE(DATA_BITS);                             \
+      int cf, pf, af, zf, sf, of;                      \
+      cf = 0;                                          \
+      pf = parity_table[(uint8_t)CC_DST];              \
+      af = 0;                                          \
+      zf = ((DATA_TYPE)CC_DST == 0) << 6;              \
+      sf = lshift(CC_DST, 8 - DATA_BITS) & 0x80;       \
+      of = 0;                                          \
+      return cf | pf | af | zf | sf | of;              \
+   }
+
 
-/* RUNS AS PART OF GENERATED CODE */
+/* CALLED FROM GENERATED CODE */
 /*static*/ UInt calculate_eflags_all ( UInt cc_op, UInt cc_src, UInt cc_dst )
 {
    switch (cc_op) {
-      case CC_OP_SUBL: ACTIONS_SUB(32,UChar,Char);
+   case CC_OP_COPY:
+     return cc_src & (CC_MASK_O | CC_MASK_S | CC_MASK_Z | CC_MASK_A | CC_MASK_C | CC_MASK_O);
 
+      case CC_OP_SUBL:   ACTIONS_SUB(32,UChar,Char);
+      case CC_OP_LOGICL: ACTIONS_LOGIC(32,UChar,Char);
       default:
          /* shouldn't really make these calls from generated code */
          vex_printf("calculate_eflags_all( %d, 0x%x, 0x%x )\n",
@@ -114,7 +130,7 @@ static inline int lshift(int x, int n)
    }
 }
 
-/* RUNS AS PART OF GENERATED CODE */
+/* CALLED FROM GENERATED CODE */
 static UInt calculate_eflags_c ( UInt cc_op, UInt cc_src, UInt cc_dst )
 {
    return calculate_eflags_all(cc_op,cc_src,cc_dst) & CC_MASK_C;