Skip to content

Commit b901b57

Browse files
committed
Auto merge of #2788 - semio-ai:master, r=<try>
Complete i686-unknown-linux-musl ucontext_t #2787 Fix #2787
2 parents a5553c2 + e86eeec commit b901b57

File tree

1 file changed

+43
-1
lines changed
  • src/unix/linux_like/linux/musl/b32/x86

1 file changed

+43
-1
lines changed

src/unix/linux_like/linux/musl/b32/x86/mod.rs

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

45
s! {
56
pub struct stat {
@@ -112,8 +113,28 @@ s! {
112113
pub f_spare: [::c_ulong; 4],
113114
}
114115

116+
pub struct _libc_fpreg {
117+
pub significand: [u16; 4],
118+
pub exponent: u16,
119+
}
120+
121+
pub struct _libc_fpstate {
122+
pub cw: ::c_ulong,
123+
pub sw: ::c_ulong,
124+
pub tag: ::c_ulong,
125+
pub ipoff: ::c_ulong,
126+
pub cssel: ::c_ulong,
127+
pub dataoff: ::c_ulong,
128+
pub datasel: ::c_ulong,
129+
pub _st: [_libc_fpreg; 8],
130+
pub status: ::c_ulong,
131+
}
132+
115133
pub struct mcontext_t {
116-
__private: [u32; 22]
134+
pub gregs: [greg_t; 19],
135+
pub fpregs: *mut _libc_fpstate,
136+
pub oldmask: ::c_ulong,
137+
pub cr2: ::c_ulong,
117138
}
118139

119140
pub struct siginfo_t {
@@ -876,6 +897,27 @@ pub const EFL: ::c_int = 14;
876897
pub const UESP: ::c_int = 15;
877898
pub const SS: ::c_int = 16;
878899

900+
// offsets in mcontext_t.gregs from sys/ucontext.h
901+
pub const REG_GS: ::c_int = 0;
902+
pub const REG_FS: ::c_int = 1;
903+
pub const REG_ES: ::c_int = 2;
904+
pub const REG_DS: ::c_int = 3;
905+
pub const REG_EDI: ::c_int = 4;
906+
pub const REG_ESI: ::c_int = 5;
907+
pub const REG_EBP: ::c_int = 6;
908+
pub const REG_ESP: ::c_int = 7;
909+
pub const REG_EBX: ::c_int = 8;
910+
pub const REG_EDX: ::c_int = 9;
911+
pub const REG_ECX: ::c_int = 10;
912+
pub const REG_EAX: ::c_int = 11;
913+
pub const REG_TRAPNO: ::c_int = 12;
914+
pub const REG_ERR: ::c_int = 13;
915+
pub const REG_EIP: ::c_int = 14;
916+
pub const REG_CS: ::c_int = 15;
917+
pub const REG_EFL: ::c_int = 16;
918+
pub const REG_UESP: ::c_int = 17;
919+
pub const REG_SS: ::c_int = 18;
920+
879921
extern "C" {
880922
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
881923
}

0 commit comments

Comments
 (0)