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