entry: rework sched_save_state
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
c6dea48b5f
commit
1f7fd24961
3 changed files with 10 additions and 8 deletions
|
|
@ -88,11 +88,9 @@ 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
|
||||
|
|
@ -101,10 +99,17 @@ irq_epilogue:
|
|||
add rsp, 8
|
||||
iretq
|
||||
|
||||
.global sched_save_state
|
||||
sched_save_state:
|
||||
push_all
|
||||
mov [rdi + 8], rsp /* save RSP to thread->kstack_ptr */
|
||||
ret
|
||||
|
||||
.global sched_restore_state
|
||||
sched_restore_state:
|
||||
mov rsp, [rdi + 8] /* load from thread->kstack_ptr */
|
||||
jmp irq_epilogue
|
||||
mov rsp, [rdi + 8] /* load RSP from thread->kstack_ptr */
|
||||
pop_all
|
||||
ret
|
||||
|
||||
.global _syscall_enter
|
||||
_syscall_enter:
|
||||
|
|
|
|||
|
|
@ -35,10 +35,7 @@ u32 cpu_id()
|
|||
return tls_get()->cpu_id;
|
||||
}
|
||||
|
||||
void sched_save_state(struct thread *t)
|
||||
{
|
||||
t->kstack_ptr = tls_get()->irq_rsp;
|
||||
}
|
||||
void fork_trampoline();
|
||||
|
||||
/* the thread that calls this will be lost, so it should only be called
|
||||
* on the initial process, and while doing an exec
|
||||
|
|
|
|||
Loading…
Reference in a new issue