Follow ABI when calling __error from the ptrace(2) wrapper.

In particular, preserve syscall arguments on stack, since callee is
not required to preserve arg-passing registers.  Align stack.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
This commit is contained in:
Konstantin Belousov 2016-08-28 00:26:06 +00:00
parent da6e468936
commit 6a9e577413

View File

@ -42,11 +42,21 @@ __FBSDID("$FreeBSD$");
.type CNAME(__error),@function
ENTRY(ptrace)
pushq %rdi /* align stack */
pushq %rdi
pushq %rsi
pushq %rdx
pushq %rcx
#ifdef PIC
callq PIC_PLT(CNAME(__error))
#else
callq CNAME(__error)
#endif
popq %rcx
popq %rdx
popq %rsi
popq %rdi
popq %rdi
movl $0,(%rax)
mov $SYS_ptrace,%eax
KERNCALL