Skip to content

Commit 62897a7

Browse files
committed
Auto merge of #3072 - Freax13:arm/user_regs, r=JohnTitor
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. Instead of a `uregs` array, we use separate named fields. > - \[ ] Edit corresponding file(s) under `libc-test/semver` when you add/remove item(s) AFAICT there's no file for linux on arm (not aarch64). Am I missing something here?
2 parents f4d5a66 + d36bf06 commit 62897a7

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

libc-test/build.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3826,7 +3826,9 @@ fn test_linux(target: &str) {
38263826
// https://github.com/torvalds/linux/commit/dc8eeef73b63ed8988224ba6b5ed19a615163a7f
38273827
(struct_ == "sockaddr_vm" && field == "svm_zero") ||
38283828
// the `ifr_ifru` field is an anonymous union
3829-
(struct_ == "ifreq" && field == "ifr_ifru")
3829+
(struct_ == "ifreq" && field == "ifr_ifru") ||
3830+
// glibc uses a single array `uregs` instead of individual fields.
3831+
(struct_ == "user_regs" && arm)
38303832
});
38313833

38323834
cfg.skip_roundtrip(move |s| match s {

src/unix/linux_like/linux/gnu/b32/arm/mod.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,27 @@ s! {
191191
pub arm_cpsr: ::c_ulong,
192192
pub fault_address: ::c_ulong,
193193
}
194+
195+
pub struct user_regs {
196+
pub arm_r0: ::c_ulong,
197+
pub arm_r1: ::c_ulong,
198+
pub arm_r2: ::c_ulong,
199+
pub arm_r3: ::c_ulong,
200+
pub arm_r4: ::c_ulong,
201+
pub arm_r5: ::c_ulong,
202+
pub arm_r6: ::c_ulong,
203+
pub arm_r7: ::c_ulong,
204+
pub arm_r8: ::c_ulong,
205+
pub arm_r9: ::c_ulong,
206+
pub arm_r10: ::c_ulong,
207+
pub arm_fp: ::c_ulong,
208+
pub arm_ip: ::c_ulong,
209+
pub arm_sp: ::c_ulong,
210+
pub arm_lr: ::c_ulong,
211+
pub arm_pc: ::c_ulong,
212+
pub arm_cpsr: ::c_ulong,
213+
pub arm_orig_r0: ::c_ulong,
214+
}
194215
}
195216

196217
pub const VEOF: usize = 4;

0 commit comments

Comments
 (0)