summaryrefslogtreecommitdiff
path: root/lib/thread/exit+openbsd-x64.s
diff options
context:
space:
mode:
Diffstat (limited to 'lib/thread/exit+openbsd-x64.s')
-rw-r--r--lib/thread/exit+openbsd-x64.s11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/thread/exit+openbsd-x64.s b/lib/thread/exit+openbsd-x64.s
index 6421cc3..0eaf63a 100644
--- a/lib/thread/exit+openbsd-x64.s
+++ b/lib/thread/exit+openbsd-x64.s
@@ -1,15 +1,8 @@
/*
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.
*/
.globl thread$exit
thread$exit:
- /* find top of stack */
- movq %rbp,%rdi /* addr */
- andq $~0xfff,%rdi /* align it */
- addq $0x1000,%rdi
-
/*
Because OpenBSD wants a valid stack whenever
we enter the kernel, we need to toss a preallocated
@@ -19,8 +12,8 @@ thread$exit:
/* munmap(base, size) */
movq $73,%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
/* __threxit(0) */