[FAST486]

Store the faulting address in CR2 (PFLA) when a page fault occurs.


svn path=/trunk/; revision=65304
This commit is contained in:
Aleksandar Andrejevic 2014-11-07 00:00:17 +00:00
parent a25ff6fb7e
commit 572d2d2a26

View file

@ -170,15 +170,6 @@ Fast486ReadLinearMemory(PFAST486_STATE State,
/* Get the table entry */
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 */
if (Page == PAGE_ALIGN(LinearAddress))
{
@ -187,6 +178,17 @@ Fast486ReadLinearMemory(PFAST486_STATE State,
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 */
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
{
@ -237,17 +239,6 @@ Fast486WriteLinearMemory(PFAST486_STATE State,
/* Get the table entry */
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 */
if (Page == PAGE_ALIGN(LinearAddress))
{
@ -256,6 +247,19 @@ Fast486WriteLinearMemory(PFAST486_STATE State,
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 */
if (Page == PAGE_ALIGN(LinearAddress + Size - 1))
{