diff --git a/arch/x86/entry.S b/arch/x86/entry.S index 16abb335..e1c46c5c 100644 --- a/arch/x86/entry.S +++ b/arch/x86/entry.S @@ -107,6 +107,8 @@ ENTRY(handle_exception) IRET END_FUNC(handle_exception) +.align PAGE_SIZE +GLOBAL(exception_handlers) exception_handler DE X86_EX_DE 0 exception_handler DB X86_EX_DB 0 exception_handler NMI X86_EX_NMI 0 @@ -130,6 +132,7 @@ exception_handler XM X86_EX_XM 0 exception_handler VE X86_EX_VE 0 exception_handler SE X86_EX_SE 1 +GLOBAL(interrupt_handlers) interrupt_handler timer timer_interrupt_handler interrupt_handler uart uart_interrupt_handler interrupt_handler keyboard keyboard_interrupt_handler @@ -137,6 +140,7 @@ interrupt_handler keyboard keyboard_interrupt_handler interrupt_handler acpi acpi_interrupt_handler #endif +.align PAGE_SIZE ENTRY(syscall_exit) POPF @@ -157,6 +161,7 @@ ENTRY(terminate_user_task) ret END_FUNC(terminate_user_task) +.align PAGE_SIZE ENTRY(enter_usermode) /* FIXME: Add 32-bit support */ @@ -184,7 +189,6 @@ ENTRY(enter_usermode) IRET END_FUNC(enter_usermode) -.align PAGE_SIZE ENTRY(syscall_handler_entry) SAVE_CALLEE_SAVED_REGS syscall_from_usermode diff --git a/common/usermode.c b/common/usermode.c index a214d64a..e520a9c8 100644 --- a/common/usermode.c +++ b/common/usermode.c @@ -28,6 +28,9 @@ #include #include +extern void *exception_handlers; +extern void *interrupt_handlers; + long syscall_handler(long syscall_nr, long arg1, long arg2, long arg3, long arg4, long arg5) { switch (syscall_nr) { @@ -89,6 +92,9 @@ static void init_syscall(void) { void init_usermode(percpu_t *percpu) { vmap_user_4k(&cr3, virt_to_mfn(&cr3), L1_PROT); + vmap_user_4k(&user_cr3, virt_to_mfn(&user_cr3), L1_PROT); + vmap_user_4k(&exception_handlers, virt_to_mfn(&exception_handlers), L1_PROT); + vmap_user_4k(&interrupt_handlers, virt_to_mfn(&interrupt_handlers), L1_PROT); vmap_user_4k(&enter_usermode, virt_to_mfn(&enter_usermode), L1_PROT); vmap_user_4k(&syscall_handler_entry, virt_to_mfn(&syscall_handler_entry), L1_PROT); init_syscall();