summaryrefslogtreecommitdiff
path: root/lib/thread/exit+linux-x64.s
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread/exit+linux-x64.s')
-rw-r--r--lib/thread/exit+linux-x64.s13
1 files changed, 3 insertions, 10 deletions
diff --git a/lib/thread/exit+linux-x64.s b/lib/thread/exit+linux-x64.s
index a54e802..d736f6d 100644
--- a/lib/thread/exit+linux-x64.s
+++ b/lib/thread/exit+linux-x64.s
@@ -1,19 +1,12 @@
/*
-const thread.exit : (stacksz : std.size -> void)
-NOTE: must be called from the bottom of the stack, since
-we assume that %rbp is in the top 4k of the stack.
+const thread.exit : (-> void)
*/
.globl thread$exit
thread$exit:
- /* find top of stack */
- movq %rbp,%rdi /* addr */
- andq $~0xfff,%rdi /* align it */
- addq $0x1000,%rdi
-
/* munmap(base, size) */
movq $11,%rax /* munmap */
- movq -8(%rdi),%rsi /* size */
- subq %rsi,%rdi /* move to base ptr */
+ movq %fs:0x08,%rdi /* base */
+ movq %fs:0x10,%rsi /* stksz */
syscall
/* thread_exit(0) */