sched: simplify entry-exit path between processes
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
308ba36aab
commit
11bedfe3a8
7 changed files with 24 additions and 20 deletions
|
|
@ -88,9 +88,11 @@ irq_common:
|
|||
swapgs
|
||||
1:
|
||||
push_all /* pushes 15 registers */
|
||||
mov gs:[28], rsp /* save RSP after push_all for scheduler */
|
||||
mov rdi, [rsp + 120] /* irq no */
|
||||
|
||||
call irq_handler
|
||||
irq_epilogue:
|
||||
pop_all
|
||||
test qword ptr [rsp + 24], 3 /* from userspace? */
|
||||
jz 2f
|
||||
|
|
@ -99,6 +101,11 @@ irq_common:
|
|||
add rsp, 8
|
||||
iretq
|
||||
|
||||
.global sched_restore_state
|
||||
sched_restore_state:
|
||||
mov rsp, [rdi + 8] /* load from thread->kstack_ptr */
|
||||
jmp irq_epilogue
|
||||
|
||||
.global _syscall_enter
|
||||
_syscall_enter:
|
||||
swapgs
|
||||
|
|
@ -121,15 +128,6 @@ _syscall_enter:
|
|||
swapgs
|
||||
sysretq
|
||||
|
||||
/* called from the scheduler to switch processes */
|
||||
.global switch_to
|
||||
switch_to:
|
||||
push_all
|
||||
mov [rdi + 8], rsp /* 8: struct thread stack_addr offset */
|
||||
mov rsp, [rsi + 8]
|
||||
pop_all
|
||||
ret
|
||||
|
||||
/* return path after a process was execed */
|
||||
.global _enter_userspace_init
|
||||
_enter_userspace_init:
|
||||
|
|
|
|||
Loading…
Reference in a new issue