diff options
Diffstat (limited to 'libc-top-half/musl/src/thread/x32')
-rw-r--r-- | libc-top-half/musl/src/thread/x32/__set_thread_area.s | 11 | ||||
-rw-r--r-- | libc-top-half/musl/src/thread/x32/__unmapself.s | 10 | ||||
-rw-r--r-- | libc-top-half/musl/src/thread/x32/clone.s | 26 | ||||
-rw-r--r-- | libc-top-half/musl/src/thread/x32/syscall_cp.s | 31 |
4 files changed, 78 insertions, 0 deletions
diff --git a/libc-top-half/musl/src/thread/x32/__set_thread_area.s b/libc-top-half/musl/src/thread/x32/__set_thread_area.s new file mode 100644 index 0000000..c0fee87 --- /dev/null +++ b/libc-top-half/musl/src/thread/x32/__set_thread_area.s @@ -0,0 +1,11 @@ +/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ +.text +.global __set_thread_area +.hidden __set_thread_area +.type __set_thread_area,@function +__set_thread_area: + mov %edi,%esi /* shift for syscall */ + movl $0x1002,%edi /* SET_FS register */ + movl $0x4000009e,%eax /* set fs segment to */ + syscall /* arch_prctl(SET_FS, arg)*/ + ret diff --git a/libc-top-half/musl/src/thread/x32/__unmapself.s b/libc-top-half/musl/src/thread/x32/__unmapself.s new file mode 100644 index 0000000..d925460 --- /dev/null +++ b/libc-top-half/musl/src/thread/x32/__unmapself.s @@ -0,0 +1,10 @@ +/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */ +.text +.global __unmapself +.type __unmapself,@function +__unmapself: + movl $0x4000000b,%eax /* SYS_munmap */ + syscall /* munmap(arg2,arg3) */ + xor %rdi,%rdi /* exit() args: always return success */ + movl $0x4000003c,%eax /* SYS_exit */ + syscall /* exit(0) */ diff --git a/libc-top-half/musl/src/thread/x32/clone.s b/libc-top-half/musl/src/thread/x32/clone.s new file mode 100644 index 0000000..b870880 --- /dev/null +++ b/libc-top-half/musl/src/thread/x32/clone.s @@ -0,0 +1,26 @@ +.text +.global __clone +.hidden __clone +.type __clone,@function +__clone: + movl $0x40000038,%eax /* SYS_clone */ + mov %rdi,%r11 + mov %rdx,%rdi + mov %r8,%rdx + mov %r9,%r8 + mov 8(%rsp),%r10 + mov %r11,%r9 + and $-16,%rsi + sub $8,%rsi + mov %rcx,(%rsi) + syscall + test %eax,%eax + jnz 1f + xor %ebp,%ebp + pop %rdi + call *%r9 + mov %eax,%edi + movl $0x4000003c,%eax /* SYS_exit */ + syscall + hlt +1: ret diff --git a/libc-top-half/musl/src/thread/x32/syscall_cp.s b/libc-top-half/musl/src/thread/x32/syscall_cp.s new file mode 100644 index 0000000..4f10171 --- /dev/null +++ b/libc-top-half/musl/src/thread/x32/syscall_cp.s @@ -0,0 +1,31 @@ +.text +.global __cp_begin +.hidden __cp_begin +.global __cp_end +.hidden __cp_end +.global __cp_cancel +.hidden __cp_cancel +.hidden __cancel +.global __syscall_cp_asm +.hidden __syscall_cp_asm +.type __syscall_cp_asm,@function +__syscall_cp_asm: + +__cp_begin: + mov (%rdi),%eax + test %eax,%eax + jnz __cp_cancel + mov %rdi,%r11 + mov %rsi,%rax + mov %rdx,%rdi + mov %rcx,%rsi + mov %r8,%rdx + mov %r9,%r10 + mov 8(%rsp),%r8 + mov 16(%rsp),%r9 + mov %r11,8(%rsp) + syscall +__cp_end: + ret +__cp_cancel: + jmp __cancel |