diff options
author | Tom Dohrmann <erbse.13@gmx.de> | 2023-01-18 16:22:21 +0100 |
---|---|---|
committer | Tom Dohrmann <erbse.13@gmx.de> | 2023-01-22 14:07:28 +0100 |
commit | d36bf06698f4407f7d735dd8dbe00dceffa3f12a (patch) | |
tree | 614395b378cd02fdaee0732eddd67763d7910819 | |
parent | 216a428bfe9129472e0a88aac8dc331beffc8882 (diff) | |
download | rust-libc-d36bf06698f4407f7d735dd8dbe00dceffa3f12a.tar.gz |
add `user_regs` for linux on arm
This struct is used for `PTRACE_GETREGS` & `PTRACE_SETREGS`. We mirror
the name used in `glibc`. This struct is called `pt_regs` in the kernel.
glibc uses a single array `uregs` instead of individual fields. The
`asm/ptrace.h` header defined by the linux kernel defines macros to
access the individual registers. Instead of `uregs` we just define the
registers as individual fields.
-rw-r--r-- | libc-test/build.rs | 4 | ||||
-rw-r--r-- | src/unix/linux_like/linux/gnu/b32/arm/mod.rs | 21 |
2 files changed, 24 insertions, 1 deletions
diff --git a/libc-test/build.rs b/libc-test/build.rs index 602bb89ffb..6a59f12c3b 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -3811,7 +3811,9 @@ fn test_linux(target: &str) { // https://github.com/torvalds/linux/commit/dc8eeef73b63ed8988224ba6b5ed19a615163a7f (struct_ == "sockaddr_vm" && field == "svm_zero") || // the `ifr_ifru` field is an anonymous union - (struct_ == "ifreq" && field == "ifr_ifru") + (struct_ == "ifreq" && field == "ifr_ifru") || + // glibc uses a single array `uregs` instead of individual fields. + (struct_ == "user_regs" && arm) }); cfg.skip_roundtrip(move |s| match s { diff --git a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs index e0ac0dfc34..ea905eb7ca 100644 --- a/src/unix/linux_like/linux/gnu/b32/arm/mod.rs +++ b/src/unix/linux_like/linux/gnu/b32/arm/mod.rs @@ -191,6 +191,27 @@ s! { pub arm_cpsr: ::c_ulong, pub fault_address: ::c_ulong, } + + pub struct user_regs { + pub arm_r0: ::c_ulong, + pub arm_r1: ::c_ulong, + pub arm_r2: ::c_ulong, + pub arm_r3: ::c_ulong, + pub arm_r4: ::c_ulong, + pub arm_r5: ::c_ulong, + pub arm_r6: ::c_ulong, + pub arm_r7: ::c_ulong, + pub arm_r8: ::c_ulong, + pub arm_r9: ::c_ulong, + pub arm_r10: ::c_ulong, + pub arm_fp: ::c_ulong, + pub arm_ip: ::c_ulong, + pub arm_sp: ::c_ulong, + pub arm_lr: ::c_ulong, + pub arm_pc: ::c_ulong, + pub arm_cpsr: ::c_ulong, + pub arm_orig_r0: ::c_ulong, + } } pub const VEOF: usize = 4; |