Author: aandrejevic
Date: Mon May 11 02:49:25 2015
New Revision: 67648
URL:
http://svn.reactos.org/svn/reactos?rev=67648&view=rev
Log:
[FAST486]
Don't perform privilege checks while reading the IDT, GDT or TSS.
Modified:
trunk/reactos/lib/fast486/common.c
trunk/reactos/lib/fast486/common.inl
trunk/reactos/lib/fast486/opgroups.c
Modified: trunk/reactos/lib/fast486/common.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.c?rev=6…
==============================================================================
--- trunk/reactos/lib/fast486/common.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/common.c [iso-8859-1] Mon May 11 02:49:25 2015
@@ -123,7 +123,7 @@
{
/* We can't prefetch without possibly violating page permissions */
State->PrefetchValid = FALSE;
- return Fast486ReadLinearMemory(State, LinearAddress, Buffer, Size);
+ return Fast486ReadLinearMemory(State, LinearAddress, Buffer, Size,
TRUE);
}
}
@@ -131,7 +131,8 @@
if (Fast486ReadLinearMemory(State,
State->PrefetchAddress,
State->PrefetchCache,
- FAST486_CACHE_SIZE))
+ FAST486_CACHE_SIZE,
+ TRUE))
{
State->PrefetchValid = TRUE;
@@ -150,7 +151,7 @@
#endif
{
/* Read from the linear address */
- return Fast486ReadLinearMemory(State, LinearAddress, Buffer, Size);
+ return Fast486ReadLinearMemory(State, LinearAddress, Buffer, Size, TRUE);
}
}
@@ -236,7 +237,7 @@
#endif
/* Write to the linear address */
- return Fast486WriteLinearMemory(State, LinearAddress, Buffer, Size);
+ return Fast486WriteLinearMemory(State, LinearAddress, Buffer, Size, TRUE);
}
static inline BOOLEAN
@@ -253,7 +254,8 @@
State->Idtr.Address
+ Number * sizeof(*IdtEntry),
IdtEntry,
- sizeof(*IdtEntry)))
+ sizeof(*IdtEntry),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -325,7 +327,8 @@
State->TaskReg.Base,
&Tss,
State->TaskReg.Limit >=
sizeof(FAST486_TSS)
- ? sizeof(FAST486_TSS) :
sizeof(FAST486_LEGACY_TSS)))
+ ? sizeof(FAST486_TSS) :
sizeof(FAST486_LEGACY_TSS),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -622,7 +625,8 @@
State->TaskReg.Base,
&OldTss,
State->TaskReg.Limit >= sizeof(FAST486_TSS)
- ? sizeof(FAST486_TSS) : sizeof(FAST486_LEGACY_TSS)))
+ ? sizeof(FAST486_TSS) : sizeof(FAST486_LEGACY_TSS),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -649,7 +653,8 @@
if (!Fast486ReadLinearMemory(State,
State->Gdtr.Address + GET_SEGMENT_INDEX(Selector),
&NewTssDescriptor,
- sizeof(NewTssDescriptor)))
+ sizeof(NewTssDescriptor),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -703,7 +708,8 @@
NewTssAddress,
&NewTss,
NewTssLimit >= sizeof(FAST486_TSS)
- ? sizeof(FAST486_TSS) : sizeof(FAST486_LEGACY_TSS)))
+ ? sizeof(FAST486_TSS) : sizeof(FAST486_LEGACY_TSS),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -718,7 +724,8 @@
State->Gdtr.Address
+ GET_SEGMENT_INDEX(State->TaskReg.Selector),
&OldTssDescriptor,
- sizeof(OldTssDescriptor)))
+ sizeof(OldTssDescriptor),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -730,7 +737,8 @@
State->Gdtr.Address
+ GET_SEGMENT_INDEX(State->TaskReg.Selector),
&OldTssDescriptor,
- sizeof(OldTssDescriptor)))
+ sizeof(OldTssDescriptor),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -789,7 +797,8 @@
State->TaskReg.Base,
&OldTss,
State->TaskReg.Limit >= sizeof(FAST486_TSS)
- ? sizeof(FAST486_TSS) : sizeof(FAST486_LEGACY_TSS)))
+ ? sizeof(FAST486_TSS) : sizeof(FAST486_LEGACY_TSS),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -802,7 +811,8 @@
if (!Fast486WriteLinearMemory(State,
State->Gdtr.Address + GET_SEGMENT_INDEX(Selector),
&NewTssDescriptor,
- sizeof(NewTssDescriptor)))
+ sizeof(NewTssDescriptor),
+ FALSE))
{
/* Exception occurred */
return FALSE;
@@ -1041,7 +1051,8 @@
State->TaskReg.Base,
&Tss,
State->TaskReg.Limit >=
sizeof(FAST486_TSS)
- ? sizeof(FAST486_TSS) :
sizeof(FAST486_LEGACY_TSS)))
+ ? sizeof(FAST486_TSS) :
sizeof(FAST486_LEGACY_TSS),
+ FALSE))
{
/* Exception occurred */
return FALSE;
Modified: trunk/reactos/lib/fast486/common.inl
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/common.inl?rev…
==============================================================================
--- trunk/reactos/lib/fast486/common.inl [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/common.inl [iso-8859-1] Mon May 11 02:49:25 2015
@@ -150,7 +150,8 @@
Fast486ReadLinearMemory(PFAST486_STATE State,
ULONG LinearAddress,
PVOID Buffer,
- ULONG Size)
+ ULONG Size,
+ BOOLEAN CheckPrivilege)
{
/* Check if paging is enabled */
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PG)
@@ -177,7 +178,7 @@
PageLength -= PageOffset;
}
- if (!TableEntry.Present || (!TableEntry.Usermode && (Cpl > 0)))
+ if (CheckPrivilege && (!TableEntry.Present || (!TableEntry.Usermode
&& (Cpl > 0))))
{
State->ControlRegisters[FAST486_REG_CR2] = Page + PageOffset;
@@ -219,7 +220,8 @@
Fast486WriteLinearMemory(PFAST486_STATE State,
ULONG LinearAddress,
PVOID Buffer,
- ULONG Size)
+ ULONG Size,
+ BOOLEAN CheckPrivilege)
{
/* Check if paging is enabled */
if (State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_PG)
@@ -246,9 +248,10 @@
PageLength -= PageOffset;
}
- if ((!TableEntry.Present || (!TableEntry.Usermode && (Cpl > 0)))
+ if (CheckPrivilege
+ && ((!TableEntry.Present || (!TableEntry.Usermode && (Cpl
> 0)))
|| ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_WP)
- && !TableEntry.Writeable))
+ && !TableEntry.Writeable)))
{
State->ControlRegisters[FAST486_REG_CR2] = Page + PageOffset;
@@ -503,7 +506,8 @@
State->Gdtr.Address
+ GET_SEGMENT_INDEX(Selector),
Entry,
- sizeof(*Entry)))
+ sizeof(*Entry),
+ FALSE))
{
/* Exception occurred */
*EntryValid = FALSE;
@@ -524,7 +528,8 @@
State->Ldtr.Base
+ GET_SEGMENT_INDEX(Selector),
Entry,
- sizeof(*Entry)))
+ sizeof(*Entry),
+ FALSE))
{
/* Exception occurred */
*EntryValid = FALSE;
Modified: trunk/reactos/lib/fast486/opgroups.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/lib/fast486/opgroups.c?rev…
==============================================================================
--- trunk/reactos/lib/fast486/opgroups.c [iso-8859-1] (original)
+++ trunk/reactos/lib/fast486/opgroups.c [iso-8859-1] Mon May 11 02:49:25 2015
@@ -1979,7 +1979,8 @@
Fast486WriteLinearMemory(State,
State->Gdtr.Address +
GET_SEGMENT_INDEX(Selector),
&GdtEntry,
- sizeof(GdtEntry));
+ sizeof(GdtEntry),
+ FALSE /* We already made sure CPL is 0 */);
}
break;