diff --git a/lib/libc/x86_64/sys/ptrace.S b/lib/libc/x86_64/sys/ptrace.S index 5246112..9acd3c6 100644 --- a/lib/libc/x86_64/sys/ptrace.S +++ b/lib/libc/x86_64/sys/ptrace.S @@ -15,8 +15,8 @@ * documentation and/or other materials provided with the distribution. * 3. All advertising materials mentioning features or use of this software * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. + * This product includes software developed by the University of + * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -40,34 +40,20 @@ #include #include "SYS.h" -ENTRY(ptrace) -#ifdef PIC -# ifdef __thread - movq PIC_GOT(CNAME(errno)),%rax -# else - pushq %rdi - leaq errno@TLSGD(%rip),%rdi - call __tls_get_addr@PLT - popq %rdi -# endif -#else -# ifdef __thread - leaq CNAME(errno)(%rip),%rax -# else - movq errno@GOTTPOFF(%rip),%rax - addq %fs:0,%rax -# endif -#endif - movl $0,(%rax) - mov $SYS_ptrace,%eax + .weak _ptrace + .set _ptrace,__sys_ptrace + .weak ptrace + .set ptrace,__sys_ptrace +ENTRY(__sys_ptrace) + mov $SYS_ptrace,%rax KERNCALL - jb err - ret -err: + jb 1f + retq +1: #ifdef PIC movq PIC_GOT(HIDENAME(cerror)),%rdx jmp *%rdx #else jmp HIDENAME(cerror) #endif -END(ptrace) +END(__sys_ptrace)