mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 19:12:57 +00:00
[FAST486]
Store the faulting address in CR2 (PFLA) when a page fault occurs. svn path=/trunk/; revision=65304
This commit is contained in:
parent
a25ff6fb7e
commit
572d2d2a26
1 changed files with 24 additions and 20 deletions
|
@ -170,15 +170,6 @@ Fast486ReadLinearMemory(PFAST486_STATE State,
|
||||||
/* Get the table entry */
|
/* Get the table entry */
|
||||||
TableEntry.Value = Fast486GetPageTableEntry(State, Page, FALSE);
|
TableEntry.Value = Fast486GetPageTableEntry(State, Page, FALSE);
|
||||||
|
|
||||||
if (!TableEntry.Present || (!TableEntry.Usermode && (Cpl > 0)))
|
|
||||||
{
|
|
||||||
/* Exception */
|
|
||||||
Fast486ExceptionWithErrorCode(State,
|
|
||||||
FAST486_EXCEPTION_PF,
|
|
||||||
TableEntry.Present | (State->Cpl ? 0x04 : 0));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if this is the first page */
|
/* Check if this is the first page */
|
||||||
if (Page == PAGE_ALIGN(LinearAddress))
|
if (Page == PAGE_ALIGN(LinearAddress))
|
||||||
{
|
{
|
||||||
|
@ -187,6 +178,17 @@ Fast486ReadLinearMemory(PFAST486_STATE State,
|
||||||
PageLength -= PageOffset;
|
PageLength -= PageOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!TableEntry.Present || (!TableEntry.Usermode && (Cpl > 0)))
|
||||||
|
{
|
||||||
|
State->ControlRegisters[FAST486_REG_CR2] = Page + PageOffset;
|
||||||
|
|
||||||
|
/* Exception */
|
||||||
|
Fast486ExceptionWithErrorCode(State,
|
||||||
|
FAST486_EXCEPTION_PF,
|
||||||
|
TableEntry.Present | (State->Cpl ? 0x04 : 0));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if this is the last page */
|
/* Check if this is the last page */
|
||||||
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
|
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
|
||||||
{
|
{
|
||||||
|
@ -237,17 +239,6 @@ Fast486WriteLinearMemory(PFAST486_STATE State,
|
||||||
/* Get the table entry */
|
/* Get the table entry */
|
||||||
TableEntry.Value = Fast486GetPageTableEntry(State, Page, TRUE);
|
TableEntry.Value = Fast486GetPageTableEntry(State, Page, TRUE);
|
||||||
|
|
||||||
if ((!TableEntry.Present || (!TableEntry.Usermode && (Cpl > 0)))
|
|
||||||
|| ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_WP)
|
|
||||||
&& !TableEntry.Writeable))
|
|
||||||
{
|
|
||||||
/* Exception */
|
|
||||||
Fast486ExceptionWithErrorCode(State,
|
|
||||||
FAST486_EXCEPTION_PF,
|
|
||||||
TableEntry.Present | 0x02 | (State->Cpl ? 0x04 : 0));
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Check if this is the first page */
|
/* Check if this is the first page */
|
||||||
if (Page == PAGE_ALIGN(LinearAddress))
|
if (Page == PAGE_ALIGN(LinearAddress))
|
||||||
{
|
{
|
||||||
|
@ -256,6 +247,19 @@ Fast486WriteLinearMemory(PFAST486_STATE State,
|
||||||
PageLength -= PageOffset;
|
PageLength -= PageOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ((!TableEntry.Present || (!TableEntry.Usermode && (Cpl > 0)))
|
||||||
|
|| ((State->ControlRegisters[FAST486_REG_CR0] & FAST486_CR0_WP)
|
||||||
|
&& !TableEntry.Writeable))
|
||||||
|
{
|
||||||
|
State->ControlRegisters[FAST486_REG_CR2] = Page + PageOffset;
|
||||||
|
|
||||||
|
/* Exception */
|
||||||
|
Fast486ExceptionWithErrorCode(State,
|
||||||
|
FAST486_EXCEPTION_PF,
|
||||||
|
TableEntry.Present | 0x02 | (State->Cpl ? 0x04 : 0));
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Check if this is the last page */
|
/* Check if this is the last page */
|
||||||
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
|
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue