mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 04:03:05 +00:00
NMI Support Patch 2:
[HAL]: Simplify IDT write-protection handling (always make it R/W and restore it to previous state). [HAL]: Avoid two superflous TLB flushes. svn path=/trunk/; revision=44842
This commit is contained in:
parent
2e1b82cf72
commit
fd1ccbe10c
1 changed files with 5 additions and 21 deletions
|
@ -254,18 +254,8 @@ HalpBiosDisplayReset(VOID)
|
||||||
* the cmpxchg8b lock errata. Unprotect them here so we can set our custom
|
* the cmpxchg8b lock errata. Unprotect them here so we can set our custom
|
||||||
* invalid op-code handler.
|
* invalid op-code handler.
|
||||||
*/
|
*/
|
||||||
if (KeGetCurrentPrcb()->CpuType == 5)
|
IdtPte = GetPteAddress(((PKIPCR)KeGetPcr())->IDT);
|
||||||
{
|
RestoreWriteProtection = IdtPte->Write;
|
||||||
/* Get the PTE and check if it is has been write protected yet */
|
|
||||||
IdtPte = GetPteAddress(((PKIPCR)KeGetPcr())->IDT);
|
|
||||||
if (IdtPte->Write == 0)
|
|
||||||
{
|
|
||||||
/* Remove the protection and flush the TLB */
|
|
||||||
IdtPte->Write = 1;
|
|
||||||
__writecr3(__readcr3());
|
|
||||||
RestoreWriteProtection = TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Use special invalid opcode and GPF trap handlers */
|
/* Use special invalid opcode and GPF trap handlers */
|
||||||
HalpSwitchToRealModeTrapHandlers();
|
HalpSwitchToRealModeTrapHandlers();
|
||||||
|
@ -279,14 +269,8 @@ HalpBiosDisplayReset(VOID)
|
||||||
/* Restore kernel trap handlers */
|
/* Restore kernel trap handlers */
|
||||||
HalpRestoreTrapHandlers();
|
HalpRestoreTrapHandlers();
|
||||||
|
|
||||||
/* Check if we removed the write protection before */
|
/* Restore write permission */
|
||||||
if (RestoreWriteProtection)
|
IdtPte->Write = RestoreWriteProtection;
|
||||||
{
|
|
||||||
/* Get the PTE, restore the write protection and flush the TLB */
|
|
||||||
IdtPte = GetPteAddress(((PKIPCR)KeGetPcr())->IDT);
|
|
||||||
IdtPte->Write = 0;
|
|
||||||
__writecr3(__readcr3());
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Restore TSS and IOPM */
|
/* Restore TSS and IOPM */
|
||||||
HalpRestoreIoPermissionsAndTask();
|
HalpRestoreIoPermissionsAndTask();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue