sched: add return_from_irq
this function restores the task register states and returns from interrupt by restoring the IRETQ stack frame and running iretq
This commit is contained in:
parent
2c3b7be962
commit
ce4c1aaf40
1 changed files with 35 additions and 0 deletions
|
|
@ -192,3 +192,38 @@ _irq_schedule:
|
||||||
movq %rdi, 144(%rax)
|
movq %rdi, 144(%rax)
|
||||||
popq %rdi
|
popq %rdi
|
||||||
movq %rdi, 152(%rax)
|
movq %rdi, 152(%rax)
|
||||||
|
|
||||||
|
/* void return_from_irq(struct procregs *regs, paddr_t cr3); */
|
||||||
|
.global return_from_irq
|
||||||
|
return_from_irq:
|
||||||
|
/* restore IRETQ frame */
|
||||||
|
pushq 152(%rdi)
|
||||||
|
pushq 144(%rdi)
|
||||||
|
pushq 136(%rdi)
|
||||||
|
pushq 128(%rdi)
|
||||||
|
pushq 120(%rdi)
|
||||||
|
|
||||||
|
/* restore task registers */
|
||||||
|
movq 0(%rdi), %rax
|
||||||
|
movq 8(%rdi), %rbx
|
||||||
|
movq 16(%rdi), %rcx
|
||||||
|
movq 24(%rdi), %rdx
|
||||||
|
movq 48(%rdi), %rbp
|
||||||
|
movq 56(%rdi), %r8
|
||||||
|
movq 64(%rdi), %r9
|
||||||
|
movq 72(%rdi), %r10
|
||||||
|
movq 80(%rdi), %r11
|
||||||
|
movq 88(%rdi), %r12
|
||||||
|
movq 96(%rdi), %r13
|
||||||
|
movq 104(%rdi), %r14
|
||||||
|
movq 112(%rdi), %r15
|
||||||
|
|
||||||
|
/* load new page tables */
|
||||||
|
movq %rsi, %cr3
|
||||||
|
|
||||||
|
/* restore argument registers */
|
||||||
|
movq 32(%rdi), %rsi
|
||||||
|
movq 40(%rdi), %rdi
|
||||||
|
|
||||||
|
iretq
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue