Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/arch/x86_64/sys Save and restore all the registers ...
details: https://anonhg.NetBSD.org/src/rev/e467533f7dc3
branches: trunk
changeset: 344284:e467533f7dc3
user: christos <christos%NetBSD.org@localhost>
date: Sat Mar 19 21:27:38 2016 +0000
description:
Save and restore all the registers we need instead of playing tricks and
"knowing" which registers the compiler clobbers. gcc-5.3 clobbers both
rcx and rdx...
diffstat:
lib/libc/arch/x86_64/sys/ptrace.S | 20 +++++++++++---------
1 files changed, 11 insertions(+), 9 deletions(-)
diffs (47 lines):
diff -r e4da54733326 -r e467533f7dc3 lib/libc/arch/x86_64/sys/ptrace.S
--- a/lib/libc/arch/x86_64/sys/ptrace.S Sat Mar 19 20:57:48 2016 +0000
+++ b/lib/libc/arch/x86_64/sys/ptrace.S Sat Mar 19 21:27:38 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: ptrace.S,v 1.6 2014/11/24 15:33:18 christos Exp $ */
+/* $NetBSD: ptrace.S,v 1.7 2016/03/19 21:27:38 christos Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -36,7 +36,7 @@
#include <machine/asm.h>
#if defined(SYSLIBC_SCCS) && !defined(lint)
- RCSID("$NetBSD: ptrace.S,v 1.6 2014/11/24 15:33:18 christos Exp $")
+ RCSID("$NetBSD: ptrace.S,v 1.7 2016/03/19 21:27:38 christos Exp $")
#endif /* SYSLIBC_SCCS and not lint */
#include "SYS.h"
@@ -46,19 +46,21 @@
ENTRY(ptrace)
/*
* The following code calls __errno() to set it to 0 before
- * calling ptrace(2). The libc version of __errno() does not use
- * any registers, but the libpthread version clobbers %rcx
- * before we get a chance to store it in %r10. So we save it
- * in %r10 and restore it.
+ * calling ptrace(2). Preserve and restore all the parameters
*/
- movq %rcx, %r10
+ pushq %rdi
+ pushq %rsi
+ pushq %rdx
+ pushq %rcx
#ifdef __PIC__
call PIC_PLT(_C_LABEL(__errno))
#else
call _C_LABEL(__errno)
#endif /* __PIC__ */
- movl $0,(%rax)
- movq %r10, %rcx
+ popq %rcx
+ popq %rdx
+ popq %rsi
+ popq %rdi
SYSTRAP(ptrace)
jc err
ret
Home |
Main Index |
Thread Index |
Old Index