Skip to content

Commit 6dae870

Browse files
committed
Auto merge of #1554 - nmattia:nm-mcontext, r=gnzlbg
Refine definition of mcontext_t on x86_64-unknown-linux-musl Fixes #1553 I've inlined the links I used for defining constants and fields, although they pretty much map to the changes introduced in ac7f0fa and ae06c2b.
2 parents ab654a6 + e691d94 commit 6dae870

File tree

1 file changed

+34
-1
lines changed
  • src/unix/linux_like/linux/musl/b64/x86_64

1 file changed

+34
-1
lines changed

src/unix/linux_like/linux/musl/b64/x86_64/mod.rs

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ pub type wchar_t = i32;
33
pub type nlink_t = u64;
44
pub type blksize_t = ::c_long;
55
pub type __u64 = ::c_ulonglong;
6+
pub type greg_t = i64;
67

78
s! {
89
pub struct stat {
@@ -99,8 +100,12 @@ s! {
99100
pub u_debugreg: [::c_ulong; 8],
100101
}
101102

103+
// GitHub repo: ifduyue/musl/
104+
// commit: b4b1e10364c8737a632be61582e05a8d3acf5690
105+
// file: arch/x86_64/bits/signal.h#L80-L84
102106
pub struct mcontext_t {
103-
__private: [u64; 32],
107+
pub gregs: [greg_t; 23],
108+
__private: [u64; 9],
104109
}
105110

106111
pub struct ipc_perm {
@@ -603,6 +608,34 @@ pub const ES: ::c_int = 24;
603608
pub const FS: ::c_int = 25;
604609
pub const GS: ::c_int = 26;
605610

611+
// offsets in mcontext_t.gregs from bits/signal.h
612+
// GitHub repo: ifduyue/musl/
613+
// commit: b4b1e10364c8737a632be61582e05a8d3acf5690
614+
// file: arch/x86_64/bits/signal.h#L9-L56
615+
pub const REG_R8: ::c_int = 0;
616+
pub const REG_R9: ::c_int = 1;
617+
pub const REG_R10: ::c_int = 2;
618+
pub const REG_R11: ::c_int = 3;
619+
pub const REG_R12: ::c_int = 4;
620+
pub const REG_R13: ::c_int = 5;
621+
pub const REG_R14: ::c_int = 6;
622+
pub const REG_R15: ::c_int = 7;
623+
pub const REG_RDI: ::c_int = 8;
624+
pub const REG_RSI: ::c_int = 9;
625+
pub const REG_RBP: ::c_int = 10;
626+
pub const REG_RBX: ::c_int = 11;
627+
pub const REG_RDX: ::c_int = 12;
628+
pub const REG_RAX: ::c_int = 13;
629+
pub const REG_RCX: ::c_int = 14;
630+
pub const REG_RSP: ::c_int = 15;
631+
pub const REG_RIP: ::c_int = 16;
632+
pub const REG_EFL: ::c_int = 17;
633+
pub const REG_CSGSFS: ::c_int = 18;
634+
pub const REG_ERR: ::c_int = 19;
635+
pub const REG_TRAPNO: ::c_int = 20;
636+
pub const REG_OLDMASK: ::c_int = 21;
637+
pub const REG_CR2: ::c_int = 22;
638+
606639
pub const MADV_SOFT_OFFLINE: ::c_int = 101;
607640
pub const MAP_32BIT: ::c_int = 0x0040;
608641
pub const O_APPEND: ::c_int = 1024;

0 commit comments

Comments
 (0)