|
1 | 1 | pub type c_char = i8;
|
2 | 2 | pub type wchar_t = i32;
|
| 3 | +pub type greg_t = i32; |
3 | 4 |
|
4 | 5 | s! {
|
5 | 6 | pub struct stat {
|
@@ -112,8 +113,28 @@ s! {
|
112 | 113 | pub f_spare: [::c_ulong; 4],
|
113 | 114 | }
|
114 | 115 |
|
| 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 | + |
115 | 133 | 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, |
117 | 138 | }
|
118 | 139 |
|
119 | 140 | pub struct siginfo_t {
|
@@ -876,6 +897,27 @@ pub const EFL: ::c_int = 14;
|
876 | 897 | pub const UESP: ::c_int = 15;
|
877 | 898 | pub const SS: ::c_int = 16;
|
878 | 899 |
|
| 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 | + |
879 | 921 | extern "C" {
|
880 | 922 | pub fn getrandom(buf: *mut ::c_void, buflen: ::size_t, flags: ::c_uint) -> ::ssize_t;
|
881 | 923 | }
|
|
0 commit comments