arm, i386: switch back to use PTRACE_GETREGS
PTRACE_GETREGSET and PTRACE_GETREGS methods are equally good on arm and
i386 architectures, but PTRACE_GETREGSET with fallback to PTRACE_GETREGS
is a bit more costly, so choose the method that costs less.
This partially reverts commit v4.7-149-gfaa177e.
* syscall.c [ARM, I386] (ARCH_REGS_FOR_GETREGSET): Remove.
(get_regset) [ARM || I386]: Remove.
(get_regs) [ARM || I386]: Use PTRACE_GETREGS unconditionally.
diff --git a/syscall.c b/syscall.c
index b5ce90e..85a8d28 100644
--- a/syscall.c
+++ b/syscall.c
@@ -663,7 +663,6 @@
static struct user_regs_struct i386_regs;
/* Cast suppresses signedness warning (.esp is long, not unsigned long) */
uint32_t *const i386_esp_ptr = (uint32_t*)&i386_regs.esp;
-# define ARCH_REGS_FOR_GETREGSET i386_regs
#elif defined(X86_64) || defined(X32)
/*
* On i386, pt_regs and user_regs_struct are the same,
@@ -711,7 +710,6 @@
static long bfin_r0;
#elif defined(ARM)
struct pt_regs arm_regs; /* not static */
-# define ARCH_REGS_FOR_GETREGSET arm_regs
#elif defined(AARCH64)
struct arm_pt_regs {
int uregs[18];
@@ -1015,9 +1013,7 @@
static void get_regset(pid_t pid)
{
/* constant iovec */
-# if defined(ARM) \
- || defined(I386) \
- || defined(METAG) \
+# if defined(METAG) \
|| defined(OR1K) \
|| defined(ARC)
static struct iovec io = {
@@ -1048,8 +1044,12 @@
get_regset(pid);
/* PTRACE_GETREGS only */
+# elif defined(ARM)
+ get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &arm_regs);
# elif defined(AVR32)
get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &avr32_regs);
+# elif defined(I386)
+ get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &i386_regs);
# elif defined(TILE)
get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &tile_regs);
# elif defined(SPARC) || defined(SPARC64)
@@ -1081,11 +1081,7 @@
return;
getregset_support = -1;
}
-# if defined(ARM)
- get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &arm_regs);
-# elif defined(I386)
- get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &i386_regs);
-# elif defined(X86_64)
+# if defined(X86_64)
/* Use old method, with unreliable heuristical detection of 32-bitness. */
x86_io.iov_len = sizeof(x86_64_regs);
get_regs_error = ptrace(PTRACE_GETREGS, pid, NULL, &x86_64_regs);
@@ -1115,7 +1111,7 @@
}
# else
# error unhandled architecture
-# endif /* ARM || I386 || X86_64 */
+# endif /* X86_64 */
# endif
}
#endif /* !get_regs */