mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
Change the type for the page fault handler from trap to interrupt gate.
Enable interrupts on page faults only if the faulting process has interrupts enabled. svn path=/trunk/; revision=3799
This commit is contained in:
parent
d6ec424dbf
commit
baf7670d00
1 changed files with 31 additions and 17 deletions
|
@ -46,6 +46,8 @@
|
|||
|
||||
/* GLOBALS *****************************************************************/
|
||||
|
||||
#define FLAG_IF (1<<9)
|
||||
|
||||
#define _STR(x) #x
|
||||
#define STR(x) _STR(x)
|
||||
|
||||
|
@ -522,7 +524,10 @@ KiTrapHandler(PKTRAP_FRAME Tf, ULONG ExceptionNr)
|
|||
*/
|
||||
if (ExceptionNr == 14)
|
||||
{
|
||||
__asm__("sti\n\t");
|
||||
if (Tf->Eflags & FLAG_IF)
|
||||
{
|
||||
__asm__("sti\n\t");
|
||||
}
|
||||
Status = MmPageFault(Tf->Cs&0xffff,
|
||||
&Tf->Eip,
|
||||
&Tf->Eax,
|
||||
|
@ -576,6 +581,14 @@ static void set_system_call_gate(unsigned int sel, unsigned int func)
|
|||
static void set_interrupt_gate(unsigned int sel, unsigned int func)
|
||||
{
|
||||
DPRINT("set_interrupt_gate(sel %d, func %x)\n",sel,func);
|
||||
KiIdt[sel].a = (((int)func)&0xffff) +
|
||||
(KERNEL_CS << 16);
|
||||
KiIdt[sel].b = 0x8e00 + (((int)func)&0xffff0000);
|
||||
}
|
||||
|
||||
static void set_trap_gate(unsigned int sel, unsigned int func)
|
||||
{
|
||||
DPRINT("set_trap_gate(sel %d, func %x)\n",sel,func);
|
||||
KiIdt[sel].a = (((int)func)&0xffff) +
|
||||
(KERNEL_CS << 16);
|
||||
KiIdt[sel].b = 0x8f00 + (((int)func)&0xffff0000);
|
||||
|
@ -601,27 +614,28 @@ KeInitExceptions(VOID)
|
|||
/*
|
||||
* Set up the other gates
|
||||
*/
|
||||
set_interrupt_gate(0, (ULONG)KiTrap0);
|
||||
set_interrupt_gate(1, (ULONG)KiTrap1);
|
||||
set_interrupt_gate(2, (ULONG)KiTrap2);
|
||||
set_interrupt_gate(3, (ULONG)KiTrap3);
|
||||
set_interrupt_gate(4, (ULONG)KiTrap4);
|
||||
set_interrupt_gate(5, (ULONG)KiTrap5);
|
||||
set_interrupt_gate(6, (ULONG)KiTrap6);
|
||||
set_interrupt_gate(7, (ULONG)KiTrap7);
|
||||
set_trap_gate(0, (ULONG)KiTrap0);
|
||||
set_trap_gate(1, (ULONG)KiTrap1);
|
||||
set_trap_gate(2, (ULONG)KiTrap2);
|
||||
set_trap_gate(3, (ULONG)KiTrap3);
|
||||
set_trap_gate(4, (ULONG)KiTrap4);
|
||||
set_trap_gate(5, (ULONG)KiTrap5);
|
||||
set_trap_gate(6, (ULONG)KiTrap6);
|
||||
set_trap_gate(7, (ULONG)KiTrap7);
|
||||
set_task_gate(8, TRAP_TSS_SELECTOR);
|
||||
set_interrupt_gate(9, (ULONG)KiTrap9);
|
||||
set_interrupt_gate(10, (ULONG)KiTrap10);
|
||||
set_interrupt_gate(11, (ULONG)KiTrap11);
|
||||
set_interrupt_gate(12, (ULONG)KiTrap12);
|
||||
set_interrupt_gate(13, (ULONG)KiTrap13);
|
||||
set_trap_gate(9, (ULONG)KiTrap9);
|
||||
set_trap_gate(10, (ULONG)KiTrap10);
|
||||
set_trap_gate(11, (ULONG)KiTrap11);
|
||||
set_trap_gate(12, (ULONG)KiTrap12);
|
||||
set_trap_gate(13, (ULONG)KiTrap13);
|
||||
set_trap_gate(14, (ULONG)KiTrap14);
|
||||
set_interrupt_gate(14, (ULONG)KiTrap14);
|
||||
set_interrupt_gate(15, (ULONG)KiTrap15);
|
||||
set_interrupt_gate(16, (ULONG)KiTrap16);
|
||||
set_trap_gate(15, (ULONG)KiTrap15);
|
||||
set_trap_gate(16, (ULONG)KiTrap16);
|
||||
|
||||
for (i=17;i<256;i++)
|
||||
{
|
||||
set_interrupt_gate(i,(int)KiTrapUnknown);
|
||||
set_trap_gate(i,(int)KiTrapUnknown);
|
||||
}
|
||||
|
||||
set_system_call_gate(0x2d,(int)interrupt_handler2d);
|
||||
|
|
Loading…
Reference in a new issue