2023-02-02 23:24:12 +02:00
|
|
|
# uint64_t read_rip()
|
|
|
|
.global read_rip
|
|
|
|
read_rip:
|
|
|
|
popq %rax
|
|
|
|
jmp *%rax
|
|
|
|
|
|
|
|
exit_thread_trampoline:
|
|
|
|
movq 8(%rsp), %rdi
|
|
|
|
ret
|
|
|
|
|
2023-03-02 01:56:09 +02:00
|
|
|
# void start_thread(uint64_t function, uint64_t rsp, uint64_t rip)
|
2023-02-02 23:24:12 +02:00
|
|
|
.global start_thread
|
|
|
|
start_thread:
|
2023-03-02 01:56:09 +02:00
|
|
|
movq %rsi, %rsp
|
2023-02-19 17:53:29 +02:00
|
|
|
movq $0, %rbp
|
2023-02-02 23:24:12 +02:00
|
|
|
pushq $exit_thread_trampoline
|
|
|
|
sti
|
2023-03-02 01:56:09 +02:00
|
|
|
jmp *%rdx
|
2023-02-02 23:24:12 +02:00
|
|
|
|
2023-02-19 17:53:29 +02:00
|
|
|
# void continue_thread(uint64_t rsp, uint64_t rip)
|
2023-02-02 23:24:12 +02:00
|
|
|
.global continue_thread
|
|
|
|
continue_thread:
|
|
|
|
movq %rdi, %rsp
|
|
|
|
movq $0, %rax
|
2023-02-19 17:53:29 +02:00
|
|
|
jmp *%rsi
|