import vanilla x86_64 code as x32

This commit is contained in:
rofl0r 2014-01-07 22:43:34 +01:00
commit 323272db17
75 changed files with 2677 additions and 0 deletions

View file

@ -0,0 +1,10 @@
/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
.text
.global __set_thread_area
.type __set_thread_area,@function
__set_thread_area:
mov %rdi,%rsi /* shift for syscall */
movl $0x1002,%edi /* SET_FS register */
movl $158,%eax /* set fs segment to */
syscall /* arch_prctl(SET_FS, arg)*/
ret

View file

@ -0,0 +1,10 @@
/* Copyright 2011-2012 Nicholas J. Kain, licensed under standard MIT license */
.text
.global __unmapself
.type __unmapself,@function
__unmapself:
movl $11,%eax /* SYS_munmap */
syscall /* munmap(arg2,arg3) */
xor %rdi,%rdi /* exit() args: always return success */
movl $60,%eax /* SYS_exit */
syscall /* exit(0) */

27
src/thread/x32/clone.s Normal file
View file

@ -0,0 +1,27 @@
.text
.global __clone
.type __clone,@function
__clone:
xor %eax,%eax
mov $56,%al
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
xor %eax,%eax
mov $60,%al
syscall
hlt
1: ret

View file

@ -0,0 +1,23 @@
.text
.global __syscall_cp_asm
.type __syscall_cp_asm,@function
__syscall_cp_asm:
.global __cp_begin
__cp_begin:
mov (%rdi),%eax
test %eax,%eax
jnz __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
.global __cp_end
__cp_end:
ret