[FAST486]

- Only flush the TLB when needed.
- Flush the TLB after a reset.


svn path=/trunk/; revision=67698
This commit is contained in:
Aleksandar Andrejevic 2015-05-12 19:10:52 +00:00
parent 5670e997ca
commit 0dc2da8084
4 changed files with 17 additions and 3 deletions

View file

@ -834,7 +834,7 @@ Fast486TaskSwitch(PFAST486_STATE State, FAST486_TASK_SWITCH_TYPE Type, USHORT Se
} }
/* Flush the TLB */ /* Flush the TLB */
if (State->Tlb) RtlFillMemory(State->Tlb, NUM_TLB_ENTRIES * sizeof(ULONG), 0xFF); Fast486FlushTlb(State);
/* Update the CPL */ /* Update the CPL */
if (NewTssLimit >= (sizeof(FAST486_TSS) - 1)) State->Cpl = GET_SEGMENT_RPL(NewTss.Cs); if (NewTssLimit >= (sizeof(FAST486_TSS) - 1)) State->Cpl = GET_SEGMENT_RPL(NewTss.Cs);

View file

@ -138,12 +138,23 @@ Fast486GetPageTableEntry(PFAST486_STATE State,
{ {
/* Set the TLB entry */ /* Set the TLB entry */
State->Tlb[VirtualAddress >> 12] = TableEntry.Value; State->Tlb[VirtualAddress >> 12] = TableEntry.Value;
State->TlbEmpty = FALSE;
} }
/* Return the table entry */ /* Return the table entry */
return TableEntry.Value; return TableEntry.Value;
} }
FORCEINLINE
VOID
FASTCALL
Fast486FlushTlb(PFAST486_STATE State)
{
if (!State->Tlb || State->TlbEmpty) return;
RtlFillMemory(State->Tlb, NUM_TLB_ENTRIES * sizeof(ULONG), 0xFF);
State->TlbEmpty = TRUE;
}
FORCEINLINE FORCEINLINE
BOOLEAN BOOLEAN
FASTCALL FASTCALL

View file

@ -640,10 +640,10 @@ FAST486_OPCODE_HANDLER(Fast486ExtOpcodeLoadControlReg)
State->PrefetchValid = FALSE; State->PrefetchValid = FALSE;
#endif #endif
if (State->Tlb && (ModRegRm.Register == (INT)FAST486_REG_CR3)) if (ModRegRm.Register == (INT)FAST486_REG_CR3)
{ {
/* Flush the TLB */ /* Flush the TLB */
RtlFillMemory(State->Tlb, NUM_TLB_ENTRIES * sizeof(ULONG), 0xFF); Fast486FlushTlb(State);
} }
/* Load a value to the control register */ /* Load a value to the control register */

View file

@ -284,6 +284,9 @@ Fast486Reset(PFAST486_STATE State)
State->IntAckCallback = IntAckCallback; State->IntAckCallback = IntAckCallback;
State->FpuCallback = FpuCallback; State->FpuCallback = FpuCallback;
State->Tlb = Tlb; State->Tlb = Tlb;
/* Flush the TLB */
Fast486FlushTlb(State);
} }
VOID VOID