Fix user apps randomly crashing (APIC, GDT layout, syscall entry)
All checks were successful
Build documentation / build-and-deploy (push) Successful in 23s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 23s
This commit is contained in:
@@ -7,39 +7,41 @@
|
||||
pushq $z;
|
||||
|
||||
#define no_err(z) \
|
||||
pushq $0; \
|
||||
pushq $0; \
|
||||
pushq $z;
|
||||
|
||||
#define make_intr_stub(x, n) \
|
||||
.global amd64_intr ## n; \
|
||||
amd64_intr ## n:; \
|
||||
x(n); \
|
||||
cli; \
|
||||
;\
|
||||
push_regs; \
|
||||
;\
|
||||
cld; \
|
||||
;\
|
||||
movq %rsp, %rdi; \
|
||||
;\
|
||||
movq %cr3, %rax; \
|
||||
pushq %rax; \
|
||||
;\
|
||||
movq %rsp, %rbp; \
|
||||
;\
|
||||
subq $8, %rsp; \
|
||||
andq $~0xF, %rsp; \
|
||||
;\
|
||||
callq amd64_intr_handler; \
|
||||
;\
|
||||
movq %rbp, %rsp; \
|
||||
;\
|
||||
popq %rax; \
|
||||
movq %rax, %cr3
|
||||
;\
|
||||
pop_regs; \
|
||||
addq $16, %rsp; \
|
||||
;\
|
||||
#define make_intr_stub(x, n) \
|
||||
.global amd64_intr ## n; \
|
||||
amd64_intr ## n:; \
|
||||
x(n); \
|
||||
cli; \
|
||||
; \
|
||||
push_regs; \
|
||||
; \
|
||||
movw $0x10, %ax; \
|
||||
movw %ax, %ds; \
|
||||
movw %ax, %es; \
|
||||
; \
|
||||
cld; \
|
||||
; \
|
||||
movq %rsp, %rdi; \
|
||||
; \
|
||||
movq %cr3, %rax; pushq %rax; \
|
||||
; \
|
||||
movq %rsp, %rbp; \
|
||||
; \
|
||||
subq $8, %rsp; \
|
||||
andq $-16, %rsp; \
|
||||
; \
|
||||
callq amd64_intr_handler; \
|
||||
; \
|
||||
movq %rbp, %rsp; \
|
||||
; \
|
||||
popq %rax; movq %rax, %cr3; \
|
||||
; \
|
||||
pop_regs; \
|
||||
addq $16, %rsp; \
|
||||
; \
|
||||
iretq;
|
||||
|
||||
|
||||
@@ -95,3 +97,4 @@ make_intr_stub(no_err, 47)
|
||||
make_intr_stub(no_err, SCHED_PREEMPT_TIMER)
|
||||
make_intr_stub(no_err, TLB_SHOOTDOWN)
|
||||
make_intr_stub(no_err, CPU_REQUEST_SCHED)
|
||||
make_intr_stub(no_err, CPU_SPURIOUS)
|
||||
|
||||
Reference in New Issue
Block a user