2023-02-02 23:24:12 +02:00
|
|
|
# uint32_t read_rip()
|
|
|
|
.global read_rip
|
|
|
|
read_rip:
|
|
|
|
popl %eax
|
|
|
|
jmp *%eax
|
|
|
|
|
|
|
|
exit_thread_trampoline:
|
2023-03-02 01:56:09 +02:00
|
|
|
addl $4, %esp
|
|
|
|
pushl (%esp)
|
2023-02-02 23:24:12 +02:00
|
|
|
ret
|
|
|
|
|
2023-03-09 15:25:39 +02:00
|
|
|
# void start_thread(uint32_t esp, uint32_t eip)
|
2023-02-02 23:24:12 +02:00
|
|
|
.global start_thread
|
|
|
|
start_thread:
|
2023-03-09 15:25:39 +02:00
|
|
|
movl 8(%esp), %ecx
|
|
|
|
movl 4(%esp), %esp
|
2023-02-19 17:53:29 +02:00
|
|
|
movl $0, %ebp
|
2023-04-08 00:31:57 +03:00
|
|
|
movl $0, (%esp)
|
2023-03-09 15:25:39 +02:00
|
|
|
pushl $exit_thread_trampoline
|
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
|