From d7aaba8c85cc71f3184cddcf20b740c5157c864d Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sun, 7 Dec 2014 11:49:52 +0100 Subject: Refactor kmalloc & tests in kmain. --- kernel/l0/paging.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'kernel/l0/paging.c') diff --git a/kernel/l0/paging.c b/kernel/l0/paging.c index 744424f..3f38997 100644 --- a/kernel/l0/paging.c +++ b/kernel/l0/paging.c @@ -60,7 +60,7 @@ void page_fault_handler(registers_t *regs) { invlpg(¤t_pt[pt]); return; } - asm volatile("sti"); // from now on we are preemptible + if (regs->eflags & EFLAGS_IF) asm volatile("sti"); // from now on we are preemptible if (vaddr >= (void*)&kernel_stack_protector && vaddr < (void*)&kernel_stack_protector + PAGE_SIZE) { dbg_printf("Kernel stack overflow at 0x%p\n", vaddr); @@ -87,7 +87,7 @@ void page_fault_handler(registers_t *regs) { } i->pf(current_pd_d, i, vaddr); } else { - asm volatile("sti"); // userspace PF handlers should always be preemptible + if (regs->eflags & EFLAGS_IF) asm volatile("sti"); // userspace PF handlers should always be preemptible dbg_printf("Userspace page fault at 0x%p\n", vaddr); PANIC("Unhandled userspace page fault"); -- cgit v1.2.3