2023-02-02 23:24:12 +02:00
|
|
|
# uint32_t read_rip()
|
|
|
|
.global read_rip
|
|
|
|
read_rip:
|
|
|
|
popl %eax
|
|
|
|
jmp *%eax
|
|
|
|
|
|
|
|
exit_thread_trampoline:
|
|
|
|
addl $16, %esp
|
|
|
|
popl %eax
|
|
|
|
pushl $0x696969
|
|
|
|
pushl %eax
|
|
|
|
ret
|
|
|
|
|
2023-02-19 17:53:29 +02:00
|
|
|
# void start_thread(uint32_t arg0, uint32_t arg1, uint32_t arg2, uint32_t arg3, uint32_t rsp, uint32_t rip)
|
2023-02-02 23:24:12 +02:00
|
|
|
.global start_thread
|
|
|
|
start_thread:
|
|
|
|
movl %esp, %eax
|
2023-02-19 17:53:29 +02:00
|
|
|
movl 24(%eax), %ecx
|
2023-02-02 23:24:12 +02:00
|
|
|
movl 20(%eax), %esp
|
|
|
|
|
|
|
|
pushl 16(%eax)
|
|
|
|
pushl 12(%eax)
|
|
|
|
pushl 8(%eax)
|
|
|
|
pushl 4(%eax)
|
|
|
|
pushl $exit_thread_trampoline
|
|
|
|
|
2023-02-19 17:53:29 +02:00
|
|
|
movl $0, %ebp
|
|
|
|
|
2023-02-02 23:24:12 +02:00
|
|
|
sti
|
|
|
|
jmp *%ecx
|
|
|
|
|
2023-02-19 17:53:29 +02:00
|
|
|
# void continue_thread(uint32_t rsp, uint32_t rip)
|
2023-02-02 23:24:12 +02:00
|
|
|
.global continue_thread
|
|
|
|
continue_thread:
|
2023-02-19 17:53:29 +02:00
|
|
|
movl 8(%esp), %ecx
|
2023-02-02 23:24:12 +02:00
|
|
|
movl 4(%esp), %esp
|
|
|
|
movl $0, %eax
|
|
|
|
jmp *%ecx
|