Author: hbelusca
Date: Mon Oct 20 19:42:52 2014
New Revision: 64851

URL: http://svn.reactos.org/svn/reactos?rev=64851&view=rev
Log:
[FAST486]
- Control register 0 is CR0: use FAST486_REG_CR0 instead of 0, as it is done in 
the rest of the code.
- Improve a if/else if control.
- Don't halt the processor in the middle of prefixes processing.

Modified:
    trunk/reactos/lib/fast486/common.c
    trunk/reactos/lib/fast486/common.inl
    trunk/reactos/lib/fast486/debug.c
    trunk/reactos/lib/fast486/fast486.c
    trunk/reactos/lib/fast486/opcodes.c

Modified: trunk/reactos/lib/fast486/common.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.c?rev=64851&r1=64850&r2=64851&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/common.c  [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/common.c  [iso-8859-1] Mon Oct 20 19:42:52 2014
@@ -55,7 +55,7 @@
     }
 
     /* Check for protected mode */
-    if (State->ControlRegisters[0] & FAST486_CR0_PE)
+    if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
     {
         /* Privilege checks */
 
@@ -122,7 +122,7 @@
     }
 
     /* Check for protected mode */
-    if (State->ControlRegisters[0] & FAST486_CR0_PE)
+    if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE)
     {
         /* Privilege checks */
 

Modified: trunk/reactos/lib/fast486/common.inl
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.inl?rev=64851&r1=64850&r2=64851&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/common.inl        [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/common.inl        [iso-8859-1] Mon Oct 20 
19:42:52 2014
@@ -762,7 +762,7 @@
     ModRegRm->Register = (ModRmByte >> 3) & 0x07;
 
     /* Check the mode */
-    if ((ModRmByte >> 6) == 3)
+    if (Mode == 3)
     {
         /* The second operand is also a register */
         ModRegRm->Memory = FALSE;
@@ -886,7 +886,6 @@
                 /* [BX + SI] */
                 ModRegRm->MemoryAddress = 
State->GeneralRegs[FAST486_REG_EBX].LowWord
                                            + 
State->GeneralRegs[FAST486_REG_ESI].LowWord;
-
                 break;
             }
 
@@ -895,7 +894,6 @@
                 /* [BX + DI] */
                 ModRegRm->MemoryAddress = 
State->GeneralRegs[FAST486_REG_EBX].LowWord
                                            + 
State->GeneralRegs[FAST486_REG_EDI].LowWord;
-
                 break;
             }
 
@@ -904,7 +902,6 @@
                 /* SS:[BP + SI] */
                 ModRegRm->MemoryAddress = 
State->GeneralRegs[FAST486_REG_EBP].LowWord
                                            + 
State->GeneralRegs[FAST486_REG_ESI].LowWord;
-
                 break;
             }
 
@@ -913,7 +910,6 @@
                 /* SS:[BP + DI] */
                 ModRegRm->MemoryAddress = 
State->GeneralRegs[FAST486_REG_EBP].LowWord
                                            + 
State->GeneralRegs[FAST486_REG_EDI].LowWord;
-
                 break;
             }
 
@@ -921,7 +917,6 @@
             {
                 /* [SI] */
                 ModRegRm->MemoryAddress = 
State->GeneralRegs[FAST486_REG_ESI].LowWord;
-
                 break;
             }
 
@@ -929,7 +924,6 @@
             {
                 /* [DI] */
                 ModRegRm->MemoryAddress = 
State->GeneralRegs[FAST486_REG_EDI].LowWord;
-
                 break;
             }
 
@@ -953,7 +947,6 @@
             {
                 /* [BX] */
                 ModRegRm->MemoryAddress = 
State->GeneralRegs[FAST486_REG_EBX].LowWord;
-
                 break;
             }
         }

Modified: trunk/reactos/lib/fast486/debug.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/debug.c?rev=64851&r1=64850&r2=64851&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/debug.c   [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/debug.c   [iso-8859-1] Mon Oct 20 19:42:52 2014
@@ -137,7 +137,7 @@
 {
     DbgPrint("\nFast486DumpState -->\n");
     DbgPrint("\nCPU currently executing in %s mode at %04X:%08X\n",
-            (State->ControlRegisters[0] & FAST486_CR0_PE) ? "protected" : 
"real",
+            (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PE) ? 
"protected" : "real",
              State->SegmentRegs[FAST486_REG_CS].Selector,
              State->InstPtr.Long);
     DbgPrint("\nGeneral purpose registers:\n"

Modified: trunk/reactos/lib/fast486/fast486.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/fast486.c?rev=64851&r1=64850&r2=64851&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/fast486.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/fast486.c [iso-8859-1] Mon Oct 20 19:42:52 2014
@@ -54,9 +54,9 @@
     /* Main execution loop */
     do
     {
+        if (!State->Halted)
+        {
 NextInst:
-        if (!State->Halted)
-        {
             /* Check if this is a new instruction */
             if (State->PrefixFlags == 0) State->SavedInstPtr = State->InstPtr;
 

Modified: trunk/reactos/lib/fast486/opcodes.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/opcodes.c?rev=64851&r1=64850&r2=64851&view=diff
==============================================================================
--- trunk/reactos/lib/fast486/opcodes.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/opcodes.c [iso-8859-1] Mon Oct 20 19:42:52 2014
@@ -4985,8 +4985,7 @@
         /* Additional rule for LOOPNZ */
         if (State->Flags.Zf) Condition = FALSE;
     }
-
-    if (Opcode == 0xE1)
+    else if (Opcode == 0xE1)
     {
         /* Additional rule for LOOPZ */
         if (!State->Flags.Zf) Condition = FALSE;


Reply via email to