Skip to content

Commit 2cd2cff

Browse files
committed
Auto merge of rust-lang#280 - fiveop:refine_mcontext, r=alexcrichton
Refine defininition of mcontext_t on linux glibc x86-64 and x86.
2 parents 53e14e2 + 7c0c28f commit 2cd2cff

File tree

2 files changed

+50
-2
lines changed

2 files changed

+50
-2
lines changed

src/unix/notbsd/linux/other/b32/x86.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,30 @@
11
pub type c_char = i8;
22
pub type wchar_t = i32;
3+
pub type greg_t = i32;
34

45
s! {
6+
pub struct _libc_fpreg {
7+
pub significand: [u16; 4],
8+
pub exponent: u16,
9+
}
10+
11+
pub struct _libc_fpstate {
12+
pub cw: ::c_ulong,
13+
pub sw: ::c_ulong,
14+
pub tag: ::c_ulong,
15+
pub ipoff: ::c_ulong,
16+
pub cssel: ::c_ulong,
17+
pub dataoff: ::c_ulong,
18+
pub datasel: ::c_ulong,
19+
pub _st: [_libc_fpreg; 8],
20+
pub status: ::c_ulong,
21+
}
22+
523
pub struct mcontext_t {
6-
__private: [u32; 22]
24+
pub gregs: [greg_t; 19],
25+
pub fpregs: *mut _libc_fpstate,
26+
pub oldmask: ::c_ulong,
27+
pub cr2: ::c_ulong,
728
}
829

930
pub struct ucontext_t {

src/unix/notbsd/linux/other/b64/x86_64.rs

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ pub type c_char = i8;
44
pub type wchar_t = i32;
55
pub type nlink_t = u64;
66
pub type blksize_t = i64;
7+
pub type greg_t = i64;
78

89
s! {
910
pub struct stat {
@@ -52,8 +53,34 @@ s! {
5253
__size: [u64; 7]
5354
}
5455

56+
pub struct _libc_fpxreg {
57+
pub significand: [u16; 4],
58+
pub exponent: u16,
59+
__private: [u16; 3],
60+
}
61+
62+
pub struct _libc_xmmreg {
63+
pub element: [u32; 4],
64+
}
65+
66+
pub struct _libc_fpstate {
67+
pub cwd: u16,
68+
pub swd: u16,
69+
pub ftw: u16,
70+
pub fop: u16,
71+
pub rip: u64,
72+
pub rdp: u64,
73+
pub mxcsr: u32,
74+
pub mxcr_mask: u32,
75+
pub _st: [_libc_fpxreg; 8],
76+
pub _xmm: [_libc_xmmreg; 16],
77+
__private: [u64; 12],
78+
}
79+
5580
pub struct mcontext_t {
56-
__private: [u64; 32],
81+
pub gregs: [greg_t; 23],
82+
pub fpregs: *mut _libc_fpstate,
83+
__private: [u64; 8],
5784
}
5885

5986
pub struct ucontext_t {

0 commit comments

Comments
 (0)