Skip to content

Commit

Permalink
Auto merge of #2788 - semio-ai:master, r=Amanieu
Browse files Browse the repository at this point in the history
Complete i686-unknown-linux-musl ucontext_t #2787

Fix for #2787
  • Loading branch information
bors committed May 12, 2022
2 parents cd99f68 + e86eeec commit ce4d314
Showing 1 changed file with 43 additions and 1 deletion.
44 changes: 43 additions & 1 deletion src/unix/linux_like/linux/musl/b32/x86/mod.rs
@@ -1,5 +1,6 @@
pub type c_char = i8;
pub type wchar_t = i32;
pub type greg_t = i32;

s! {
pub struct stat {
Expand Down Expand Up @@ -112,8 +113,28 @@ s! {
pub f_spare: [::c_ulong; 4],
}

pub struct _libc_fpreg {
pub significand: [u16; 4],
pub exponent: u16,
}

pub struct _libc_fpstate {
pub cw: ::c_ulong,
pub sw: ::c_ulong,
pub tag: ::c_ulong,
pub ipoff: ::c_ulong,
pub cssel: ::c_ulong,
pub dataoff: ::c_ulong,
pub datasel: ::c_ulong,
pub _st: [_libc_fpreg; 8],
pub status: ::c_ulong,
}

pub struct mcontext_t {
__private: [u32; 22]
pub gregs: [greg_t; 19],
pub fpregs: *mut _libc_fpstate,
pub oldmask: ::c_ulong,
pub cr2: ::c_ulong,
}

pub struct siginfo_t {
Expand Down Expand Up @@ -876,6 +897,27 @@ pub const EFL: ::c_int = 14;
pub const UESP: ::c_int = 15;
pub const SS: ::c_int = 16;

// offsets in mcontext_t.gregs from sys/ucontext.h
pub const REG_GS: ::c_int = 0;
pub const REG_FS: ::c_int = 1;
pub const REG_ES: ::c_int = 2;
pub const REG_DS: ::c_int = 3;
pub const REG_EDI: ::c_int = 4;
pub const REG_ESI: ::c_int = 5;
pub const REG_EBP: ::c_int = 6;
pub const REG_ESP: ::c_int = 7;
pub const REG_EBX: ::c_int = 8;
pub const REG_EDX: ::c_int = 9;
pub const REG_ECX: ::c_int = 10;
pub const REG_EAX: ::c_int = 11;
pub const REG_TRAPNO: ::c_int = 12;
pub const REG_ERR: ::c_int = 13;
pub const REG_EIP: ::c_int = 14;
pub const REG_CS: ::c_int = 15;
pub const REG_EFL: ::c_int = 16;
pub const REG_UESP: ::c_int = 17;
pub const REG_SS: ::c_int = 18;

extern "C" {
pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
}
Expand Down

0 comments on commit ce4d314

Please sign in to comment.