-
Notifications
You must be signed in to change notification settings - Fork 1k
/
align.rs
51 lines (47 loc) · 1.48 KB
/
align.rs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
s_no_extra_traits! {
#[allow(missing_debug_implementations)]
#[repr(align(16))]
pub struct max_align_t {
priv_: [f32; 8]
}
}
s! {
pub struct ucontext_t {
pub uc_flags: ::c_ulong,
pub uc_link: *mut ucontext_t,
pub uc_stack: ::stack_t,
pub uc_sigmask: ::sigset_t,
pub uc_mcontext: mcontext_t,
}
#[repr(align(16))]
pub struct mcontext_t {
pub fault_address: ::c_ulonglong,
pub regs: [::c_ulonglong; 31],
pub sp: ::c_ulonglong,
pub pc: ::c_ulonglong,
pub pstate: ::c_ulonglong,
// nested arrays to get the right size/length while being able to
// auto-derive traits like Debug
__reserved: [[u64; 32]; 16],
}
#[repr(align(8))]
pub struct clone_args {
pub flags: ::c_ulonglong,
pub pidfd: ::c_ulonglong,
pub child_tid: ::c_ulonglong,
pub parent_tid: ::c_ulonglong,
pub exit_signal: ::c_ulonglong,
pub stack: ::c_ulonglong,
pub stack_size: ::c_ulonglong,
pub tls: ::c_ulonglong,
pub set_tid: ::c_ulonglong,
pub set_tid_size: ::c_ulonglong,
pub cgroup: ::c_ulonglong,
}
}
extern "C" {
pub fn getcontext(ucp: *mut ucontext_t) -> ::c_int;
pub fn setcontext(ucp: *const ucontext_t) -> ::c_int;
pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: ::c_int, ...);
pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> ::c_int;
}