From 2da0e38fbcbad9f35e311834f0fc025d0936074e Mon Sep 17 00:00:00 2001 From: Aleksandar Andrejevic Date: Tue, 12 Nov 2013 19:25:50 +0000 Subject: [PATCH] [FAST486] In rotate operations, the count is always masked with 0x1F, regardless of the operand size. svn path=/branches/ntvdm/; revision=60966 --- lib/fast486/extraops.c | 6 ++---- lib/fast486/opgroups.c | 16 ++++++---------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/lib/fast486/extraops.c b/lib/fast486/extraops.c index 6f66e565b7c..046ad9e1a5f 100644 --- a/lib/fast486/extraops.c +++ b/lib/fast486/extraops.c @@ -637,8 +637,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShld) } /* Normalize the count */ - if (OperandSize) Count &= 0x1F; - else Count &= 0x0F; + Count &= 0x1F; /* Do nothing if the count is zero */ if (Count == 0) return TRUE; @@ -840,8 +839,7 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeShrd) } /* Normalize the count */ - if (OperandSize) Count &= 0x1F; - else Count &= 0x0F; + Count &= 0x1F; /* Do nothing if the count is zero */ if (Count == 0) return TRUE; diff --git a/lib/fast486/opgroups.c b/lib/fast486/opgroups.c index 21aa95e2ed3..a944e8d8939 100644 --- a/lib/fast486/opgroups.c +++ b/lib/fast486/opgroups.c @@ -163,16 +163,11 @@ Fast486RotateOperation(PFAST486_STATE State, ULONG HighestBit = 1 << (Bits - 1); ULONG Result; - if ((Operation != 2) && (Operation != 3)) - { - /* Mask the count */ - Count &= Bits - 1; - } - else - { - /* For RCL and RCR, the CF is included in the value */ - Count %= Bits + 1; - } + /* Normalize the count */ + Count &= 0x1F; + + /* If the count is zero, do nothing */ + if (Count == 0) goto SetFlags; /* Check which operation is this */ switch (Operation) @@ -275,6 +270,7 @@ Fast486RotateOperation(PFAST486_STATE State, } } +SetFlags: if (Operation >= 4) { /* Update ZF, SF and PF */