summaryrefslogtreecommitdiffstats
path: root/backends/ChangeLog
diff options
context:
space:
mode:
authorMark Wielaard <[email protected]>2022-02-16 14:47:46 +0100
committerMark Wielaard <[email protected]>2022-02-16 14:47:46 +0100
commit52d72316e0d0274b2d717142601c0fff3a77f0ba (patch)
treec6e378f2f3fcd8d6b08e97c5630dcb3d9177976d /backends/ChangeLog
parentc4726913b7766634cc5d8a97624e1b4708452d73 (diff)
backends: Use PTRACE_GETREGSET for ppc_set_initial_registers_tid
The code in ppc_initreg.c used PTRACE_PEEKUSER to fetch all registers one by one. Which is slightly inefficient. It did this because it wanted things to work on linux 2.6.18 which didn't support PTRACE_GETREGSET. PTRACE_GETREGSET was only officially since 2.6.34 (but backported to some earlier versions). It seems ok to require a linux kernel that supports PTRACE_GETREGSET now. This is much more efficient since it takes just one ptrace call instead of 44 calls to fetch each register individually. For some really old versions we need to include <linux/ptrace.h> to get PTRACE_GETREGSET defined. And on ppc64 there is no 32bit version of struct pt_regs available, so we define that ourselves and check how much data is returned to know whether this is a full pt_regs or one for a 32bit process. An alternative would be to use the raw iov_base bytes with 64bit or 32bit offset constants to get at the registers instead of using a struct with names. The code works for inspecting a 32bit process from a 64bit build, but not the other way around (the previous code also didn't). This could work if we also defined and used a 64bit pt_regs struct on ppc32. But it seems a use case that is not really used (it was hard enough finding ppc32 setups to test this on). Tested against ppc and ppc64 on linux 2.6.32 and glibc 2.12 and ppc and ppc64 on linux 3.10.0 with glibc 2.17. Signed-off-by: Mark Wielaard <[email protected]>
Diffstat (limited to 'backends/ChangeLog')
-rw-r--r--backends/ChangeLog5
1 files changed, 5 insertions, 0 deletions
diff --git a/backends/ChangeLog b/backends/ChangeLog
index b48af4e1..51959259 100644
--- a/backends/ChangeLog
+++ b/backends/ChangeLog
@@ -1,3 +1,8 @@
+2022-02-16 Mark Wielaard <[email protected]>
+
+ * ppc_initreg.c (ppc_set_initial_registers_tid): Define struct
+ pt_regs32. Use PTRACE_GETREGSET.
+
2021-09-29 William Cohen <[email protected]>
* riscv_init.c (riscv_return_value_location_lp64f): New function