59092eaa53fefd472735c3a5c023a3f0ad56787d
[musl] / src / thread / x86_64 / __unmapself.s
1 /* Copyright 2011 Nicholas J. Kain, licensed GNU LGPL 2.1 or later */
2 .text
3 .global __unmapself
4 .type   __unmapself,%function
5 __unmapself:
6         call 1f         /* glibc ABI compat */
7         .long -1
8         .long -1
9 1:      push %rsi       /* save arg2 for munmap */
10         push %rdx       /* save arg3 for munmap */
11         mov %rdi,%rsi   /* rt_sigprocmask() args: move arg1 to rsi */
12         xor %rdi,%rdi
13         xor %rdx,%rdx
14         movq $8,%r10
15         movl $14,%eax   /* __NR_rt_sigprocmask */
16         syscall         /* call rt_sigprocmask(0,arg1,0,8) */
17         pop %rsi        /* munmap() args: reload from stack */
18         pop %rdi
19         movl $11,%eax   /* __NR_munmap */
20         syscall         /* munmap(arg2,arg3) */
21         xor %rdi,%rdi   /* exit() args: always return success */
22         movl $60,%eax   /* __NR_exit */
23         syscall         /* exit(0) */
24 .size __unmapself,.-__unmapself