Author: hbelusca
Date: Tue Dec 3 23:51:51 2013
New Revision: 61211
URL:
http://svn.reactos.org/svn/reactos?rev=61211&view=rev
Log:
[FAST486]
- Call Fast486GetCurrentPrivLevel only when needed.
- Fix a type.
Modified:
branches/ntvdm/lib/fast486/common.c
branches/ntvdm/lib/fast486/common.h
branches/ntvdm/lib/fast486/common.inl
branches/ntvdm/lib/fast486/opgroups.c
Modified: branches/ntvdm/lib/fast486/common.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/common.c?rev=…
==============================================================================
--- branches/ntvdm/lib/fast486/common.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/common.c [iso-8859-1] Tue Dec 3 23:51:51 2013
@@ -118,7 +118,6 @@
{
/* Write beyond limit */
Fast486Exception(State, FAST486_EXCEPTION_GP);
-
return FALSE;
}
Modified: branches/ntvdm/lib/fast486/common.h
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/common.h?rev=…
==============================================================================
--- branches/ntvdm/lib/fast486/common.h [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/common.h [iso-8859-1] Tue Dec 3 23:51:51 2013
@@ -40,19 +40,19 @@
#define SEGMENT_TABLE_INDICATOR (1 << 2)
#define EXCEPTION_HAS_ERROR_CODE(x) (((x) == 8) || ((x) >= 10 && (x) <=
14))
-#define NO_LOCK_PREFIX() if (State->PrefixFlags & FAST486_PREFIX_LOCK)\
+#define NO_LOCK_PREFIX()\
+if (State->PrefixFlags & FAST486_PREFIX_LOCK)\
{\
Fast486Exception(State, FAST486_EXCEPTION_UD);\
return FALSE;\
}
-#define TOGGLE_OPSIZE(x) if (State->PrefixFlags & FAST486_PREFIX_OPSIZE)\
-{\
- x = !x;\
-}
-#define TOGGLE_ADSIZE(x) if (State->PrefixFlags & FAST486_PREFIX_ADSIZE)\
-{\
- x = !x;\
-}
+
+#define TOGGLE_OPSIZE(x)\
+ if (State->PrefixFlags & FAST486_PREFIX_OPSIZE) x = !x;
+
+#define TOGGLE_ADSIZE(x)\
+ if (State->PrefixFlags & FAST486_PREFIX_ADSIZE) x = !x;
+
#define SWAP(x, y) { (x) ^= (y); (y) ^= (x); (x) ^= (y); }
#define PAGE_ALIGN(x) ((x) & 0xFFFFF000)
Modified: branches/ntvdm/lib/fast486/common.inl
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/common.inl?re…
==============================================================================
--- branches/ntvdm/lib/fast486/common.inl [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/common.inl [iso-8859-1] Tue Dec 3 23:51:51 2013
@@ -122,13 +122,12 @@
PVOID Buffer,
ULONG Size)
{
- INT Cpl = Fast486GetCurrentPrivLevel(State);
-
/* Check if paging is enabled */
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PG)
{
ULONG Page;
FAST486_PAGE_TABLE TableEntry;
+ INT Cpl = Fast486GetCurrentPrivLevel(State);
for (Page = PAGE_ALIGN(LinearAddress);
Page <= PAGE_ALIGN(LinearAddress + Size - 1);
@@ -151,14 +150,14 @@
/* Check if this is the first page */
if (Page == PAGE_ALIGN(LinearAddress))
{
- /* Start copying from the offset from the beginning of the page */
+ /* Start reading from the offset from the beginning of the page */
PageOffset = PAGE_OFFSET(LinearAddress);
}
/* Check if this is the last page */
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
{
- /* Copy only a part of the page */
+ /* Read only a part of the page */
PageLength = PAGE_OFFSET(LinearAddress) + Size - PageOffset;
}
@@ -185,13 +184,12 @@
PVOID Buffer,
ULONG Size)
{
- INT Cpl = Fast486GetCurrentPrivLevel(State);
-
/* Check if paging is enabled */
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PG)
{
ULONG Page;
FAST486_PAGE_TABLE TableEntry;
+ INT Cpl = Fast486GetCurrentPrivLevel(State);
for (Page = PAGE_ALIGN(LinearAddress);
Page <= PAGE_ALIGN(LinearAddress + Size - 1);
@@ -216,14 +214,14 @@
/* Check if this is the first page */
if (Page == PAGE_ALIGN(LinearAddress))
{
- /* Start copying from the offset from the beginning of the page */
+ /* Start writing from the offset from the beginning of the page */
PageOffset = PAGE_OFFSET(LinearAddress);
}
/* Check if this is the last page */
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
{
- /* Copy only a part of the page */
+ /* Write only a part of the page */
PageLength = PAGE_OFFSET(LinearAddress) + Size - PageOffset;
}
@@ -385,7 +383,7 @@
FORCEINLINE
BOOLEAN
Fast486LoadSegment(PFAST486_STATE State,
- INT Segment,
+ FAST486_SEG_REGS Segment,
USHORT Selector)
{
PFAST486_SEG_REG CachedDescriptor;
Modified: branches/ntvdm/lib/fast486/opgroups.c
URL:
http://svn.reactos.org/svn/reactos/branches/ntvdm/lib/fast486/opgroups.c?re…
==============================================================================
--- branches/ntvdm/lib/fast486/opgroups.c [iso-8859-1] (original)
+++ branches/ntvdm/lib/fast486/opgroups.c [iso-8859-1] Tue Dec 3 23:51:51 2013
@@ -1434,7 +1434,7 @@
else if (ModRegRm.Register == 3)
{
USHORT Selector;
- INT Segment = FAST486_REG_DS;
+ FAST486_SEG_REGS Segment = FAST486_REG_DS;
/* Check for the segment override */
if (State->PrefixFlags & FAST486_PREFIX_SEG)
@@ -1487,7 +1487,7 @@
else if (ModRegRm.Register == 5)
{
USHORT Selector;
- INT Segment = FAST486_REG_DS;
+ FAST486_SEG_REGS Segment = FAST486_REG_DS;
/* Check for the segment override */
if (State->PrefixFlags & FAST486_PREFIX_SEG)
@@ -1580,7 +1580,7 @@
else if (ModRegRm.Register == 3)
{
USHORT Selector;
- INT Segment = FAST486_REG_DS;
+ FAST486_SEG_REGS Segment = FAST486_REG_DS;
/* Check for the segment override */
if (State->PrefixFlags & FAST486_PREFIX_SEG)
@@ -1636,7 +1636,7 @@
else if (ModRegRm.Register == 5)
{
USHORT Selector;
- INT Segment = FAST486_REG_DS;
+ FAST486_SEG_REGS Segment = FAST486_REG_DS;
/* Check for the segment override */
if (State->PrefixFlags & FAST486_PREFIX_SEG)