Load kernel CR3
This commit is contained in:
@@ -161,6 +161,8 @@ static void amd64_intr_exception (struct saved_regs* regs) {
|
||||
|
||||
/* Handle incoming interrupt, dispatch IRQ handlers. */
|
||||
void amd64_intr_handler (void* stack_ptr) {
|
||||
amd64_load_kernel_cr3 ();
|
||||
|
||||
struct saved_regs* regs = stack_ptr;
|
||||
|
||||
if (regs->trap <= 31) {
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
;\
|
||||
movq %rsp, %rdi; \
|
||||
;\
|
||||
movq %cr3, %rax; \
|
||||
pushq %rax; \
|
||||
;\
|
||||
movq %rsp, %rbp; \
|
||||
;\
|
||||
subq $8, %rsp; \
|
||||
@@ -31,6 +34,9 @@
|
||||
;\
|
||||
movq %rbp, %rsp; \
|
||||
;\
|
||||
popq %rax; \
|
||||
movq %rax, %cr3
|
||||
;\
|
||||
pop_regs; \
|
||||
addq $16, %rsp; \
|
||||
;\
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
extern void amd64_syscall_entry (void);
|
||||
|
||||
int amd64_syscall_dispatch (void* stack_ptr) {
|
||||
amd64_load_kernel_cr3 ();
|
||||
|
||||
struct saved_regs* regs = stack_ptr;
|
||||
|
||||
int syscall_num = regs->rax;
|
||||
|
||||
@@ -23,6 +23,9 @@ amd64_syscall_entry:
|
||||
|
||||
movq %rsp, %rdi
|
||||
|
||||
movq %cr3, %rax
|
||||
pushq %rax
|
||||
|
||||
movq %rsp, %rbp
|
||||
|
||||
subq $8, %rsp
|
||||
@@ -32,6 +35,9 @@ amd64_syscall_entry:
|
||||
|
||||
movq %rbp, %rsp
|
||||
|
||||
popq %rax
|
||||
movq %rax, %cr3
|
||||
|
||||
pop_regs_skip_rax
|
||||
|
||||
addq $56, %rsp
|
||||
|
||||
Reference in New Issue
Block a user