x86_64: implement functions to jump to userspace
This commit is contained in:
@@ -2,12 +2,12 @@
|
||||
|
||||
.extern THREAD_sp
|
||||
|
||||
.global switch_to
|
||||
.type switch_to, @function
|
||||
.global ml_thread_switch
|
||||
.type ml_thread_switch, @function
|
||||
|
||||
// %rdi = (struct thread *) current thread.
|
||||
// %rsi = (struct thread *) next thread.
|
||||
switch_to:
|
||||
ml_thread_switch:
|
||||
pushfq
|
||||
|
||||
push %rax
|
||||
@@ -50,3 +50,27 @@ switch_to:
|
||||
popfq
|
||||
|
||||
ret
|
||||
|
||||
|
||||
.global ml_thread_switch_user
|
||||
.type ml_thread_switch_user, @function
|
||||
ml_thread_switch_user:
|
||||
pop %r15
|
||||
pop %r14
|
||||
pop %r13
|
||||
pop %r12
|
||||
pop %r11
|
||||
pop %r10
|
||||
pop %r9
|
||||
pop %r8
|
||||
pop %rdi
|
||||
pop %rsi
|
||||
pop %rbp
|
||||
add $8, %rsp
|
||||
pop %rbx
|
||||
pop %rdx
|
||||
pop %rcx
|
||||
pop %rax
|
||||
|
||||
add $16, %rsp
|
||||
iretq
|
||||
|
||||
Reference in New Issue
Block a user