relibc/header/signal/
redox.rs1use redox_rt::signal::SiginfoAbi;
2
3#[cfg(any(target_arch = "x86", target_arch = "aarch64", target_arch = "riscv64"))]
4use crate::platform::types::c_uchar;
5use crate::platform::types::{c_uint, c_ulong};
6
7use super::{siginfo_t, sigset_t, stack_t};
8
9pub const SA_RESTORER: usize = 0x0000_0004; pub const SA_SIGINFO: usize = 0x0200_0000;
18pub const SA_ONSTACK: usize = 0x0400_0000;
20pub const SA_RESTART: usize = 0x0800_0000;
22pub const SA_NODEFER: usize = 0x1000_0000;
24pub const SA_RESETHAND: usize = 0x2000_0000;
27pub const SA_NOCLDSTOP: usize = 0x4000_0000;
29
30const _: () = {
31 if super::constants::SS_ONSTACK != redox_rt::signal::SS_ONSTACK {
32 panic!();
33 }
34 if super::constants::SS_DISABLE != redox_rt::signal::SS_DISABLE {
35 panic!();
36 }
37 if super::constants::MINSIGSTKSZ != redox_rt::signal::MIN_SIGALTSTACK_SIZE {
38 panic!();
39 }
40};
41
42pub(crate) type ucontext_t = ucontext;
43pub(crate) type mcontext_t = mcontext;
45
46#[repr(C)]
48pub struct ucontext {
49 #[cfg(any(
50 target_arch = "x86_64",
51 target_arch = "aarch64",
52 target_arch = "riscv64"
53 ))]
54 _pad: [c_ulong; 1], #[cfg(target_arch = "x86")]
57 _pad: [c_ulong; 3], pub uc_link: *mut ucontext_t,
61 pub uc_stack: stack_t,
63 pub uc_sigmask: sigset_t,
65 _sival: c_ulong,
66 _sigcode: c_uint,
67 _signum: c_uint,
68 pub uc_mcontext: mcontext_t,
70}
71
72#[cfg(target_arch = "x86")]
73#[repr(C)]
74pub struct mcontext {
75 _opaque: [c_uchar; 512],
76}
77
78#[cfg(target_arch = "x86_64")]
81#[repr(C)]
82pub struct mcontext {
83 pub ymm_upper: [[c_ulong; 2]; 16],
84 pub fxsave: [[c_ulong; 2]; 29],
85 pub r15: c_ulong, pub r14: c_ulong, pub r13: c_ulong, pub r12: c_ulong, pub rbp: c_ulong, pub rbx: c_ulong, pub r11: c_ulong, pub r10: c_ulong,
93 pub r9: c_ulong,
94 pub r8: c_ulong,
95 pub rax: c_ulong,
96 pub rcx: c_ulong,
97 pub rdx: c_ulong,
98 pub rsi: c_ulong,
99 pub rdi: c_ulong,
100 pub rflags: c_ulong,
101 pub rip: c_ulong,
102 pub rsp: c_ulong,
103}
104
105#[cfg(target_arch = "aarch64")]
106#[repr(C)]
107pub struct mcontext {
108 _opaque: [c_uchar; 272],
109}
110
111#[cfg(target_arch = "riscv64")]
112#[repr(C)]
113pub struct mcontext {
114 _opaque: [c_uchar; 520],
115}
116
117impl From<SiginfoAbi> for siginfo_t {
118 fn from(value: SiginfoAbi) -> Self {
119 unsafe { core::mem::transmute(value) }
120 }
121}