Skip to content

Commit

Permalink
Auto merge of #1554 - nmattia:nm-mcontext, r=gnzlbg
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
bors committed Oct 16, 2019
2 parents ab654a6 + e691d94 commit 6dae870
Showing 1 changed file with 34 additions and 1 deletion.
35 changes: 34 additions & 1 deletion src/unix/linux_like/linux/musl/b64/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = ::c_long;
pub type __u64 = ::c_ulonglong;
pub type greg_t = i64;

s! {
pub struct stat {
Expand Down Expand Up @@ -99,8 +100,12 @@ s! {
pub u_debugreg: [::c_ulong; 8],
}

// GitHub repo: ifduyue/musl/
// commit: b4b1e10364c8737a632be61582e05a8d3acf5690
// file: arch/x86_64/bits/signal.h#L80-L84
pub struct mcontext_t {
__private: [u64; 32],
pub gregs: [greg_t; 23],
__private: [u64; 9],
}

pub struct ipc_perm {
Expand Down Expand Up @@ -603,6 +608,34 @@ pub const ES: ::c_int = 24;
pub const FS: ::c_int = 25;
pub const GS: ::c_int = 26;

// offsets in mcontext_t.gregs from bits/signal.h
// GitHub repo: ifduyue/musl/
// commit: b4b1e10364c8737a632be61582e05a8d3acf5690
// file: arch/x86_64/bits/signal.h#L9-L56
pub const REG_R8: ::c_int = 0;
pub const REG_R9: ::c_int = 1;
pub const REG_R10: ::c_int = 2;
pub const REG_R11: ::c_int = 3;
pub const REG_R12: ::c_int = 4;
pub const REG_R13: ::c_int = 5;
pub const REG_R14: ::c_int = 6;
pub const REG_R15: ::c_int = 7;
pub const REG_RDI: ::c_int = 8;
pub const REG_RSI: ::c_int = 9;
pub const REG_RBP: ::c_int = 10;
pub const REG_RBX: ::c_int = 11;
pub const REG_RDX: ::c_int = 12;
pub const REG_RAX: ::c_int = 13;
pub const REG_RCX: ::c_int = 14;
pub const REG_RSP: ::c_int = 15;
pub const REG_RIP: ::c_int = 16;
pub const REG_EFL: ::c_int = 17;
pub const REG_CSGSFS: ::c_int = 18;
pub const REG_ERR: ::c_int = 19;
pub const REG_TRAPNO: ::c_int = 20;
pub const REG_OLDMASK: ::c_int = 21;
pub const REG_CR2: ::c_int = 22;

pub const MADV_SOFT_OFFLINE: ::c_int = 101;
pub const MAP_32BIT: ::c_int = 0x0040;
pub const O_APPEND: ::c_int = 1024;
Expand Down

0 comments on commit 6dae870

Please sign in to comment.