Skip to content

Commit fabdf66

Browse files
committed
Finalize ucontext_t integration in mod.rs
Signed-off-by: mgiessing <[email protected]>
1 parent bf63904 commit fabdf66

File tree

1 file changed

+88
-0
lines changed
  • src/unix/linux_like/linux/gnu/b64/powerpc64

1 file changed

+88
-0
lines changed

src/unix/linux_like/linux/gnu/b64/powerpc64/mod.rs

+88
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,21 @@ s! {
189189
pub ss_flags: c_int,
190190
pub ss_size: size_t,
191191
}
192+
193+
#[repr(align(8))]
194+
pub struct clone_args {
195+
pub flags: c_ulonglong,
196+
pub pidfd: c_ulonglong,
197+
pub child_tid: c_ulonglong,
198+
pub parent_tid: c_ulonglong,
199+
pub exit_signal: c_ulonglong,
200+
pub stack: c_ulonglong,
201+
pub stack_size: c_ulonglong,
202+
pub tls: c_ulonglong,
203+
pub set_tid: c_ulonglong,
204+
pub set_tid_size: c_ulonglong,
205+
pub cgroup: c_ulonglong,
206+
}
192207
}
193208

194209
s_no_extra_traits! {
@@ -197,6 +212,70 @@ s_no_extra_traits! {
197212
pub struct max_align_t {
198213
priv_: [i64; 4],
199214
}
215+
216+
#[allow(missing_debug_implementations)]
217+
pub struct ucontext_t {
218+
pub uc_flags: c_ulong,
219+
pub uc_link: *mut ucontext_t,
220+
pub uc_stack: crate::stack_t,
221+
pub uc_sigmask: crate::sigset_t,
222+
pub uc_mcontext: mcontext_t,
223+
}
224+
225+
#[allow(missing_debug_implementations)]
226+
pub struct pt_regs {
227+
pub gpr: [c_ulong; 32],
228+
pub nip: c_ulong,
229+
pub msr: c_ulong,
230+
pub orig_gpr3: c_ulong,
231+
pub ctr: c_ulong,
232+
pub link: c_ulong,
233+
pub xer: c_ulong,
234+
pub ccr: c_ulong,
235+
pub softe: c_ulong,
236+
pub trap: c_ulong,
237+
pub dar: c_ulong,
238+
pub dsisr: c_ulong,
239+
pub result: c_ulong,
240+
}
241+
242+
#[allow(missing_debug_implementations)]
243+
#[repr(align(8))]
244+
pub struct mcontext_t {
245+
__glibc_reserved: [c_ulong; 4],
246+
pub signal: c_int,
247+
__pad0: c_int,
248+
pub handler: c_ulong,
249+
pub oldmask: c_ulong,
250+
pub regs: *mut pt_regs,
251+
pub gp_regs: [c_ulong; __NGREG],
252+
pub fp_regs: [c_double; __NFPREG],
253+
pub v_regs: *mut vrregset_t,
254+
pub vmx_reserve: [c_long; __NVRREG + __NVRREG + 1],
255+
}
256+
257+
#[allow(missing_debug_implementations)]
258+
#[repr(align(16))]
259+
pub struct vrregset_t {
260+
pub vrregs: [[c_uint; 4]; 32],
261+
pub vscr: vscr_t,
262+
pub vrsave: c_uint,
263+
__pad: [c_uint; 3],
264+
}
265+
266+
#[allow(missing_debug_implementations)]
267+
#[repr(align(4))]
268+
pub struct vscr_t {
269+
#[cfg(target_endian = "big")]
270+
__pad: [c_uint; 3],
271+
#[cfg(target_endian = "big")]
272+
pub vscr_word: c_uint,
273+
274+
#[cfg(target_endian = "little")]
275+
pub vscr_word: c_uint,
276+
#[cfg(target_endian = "little")]
277+
__pad: [c_uint; 3],
278+
}
200279
}
201280

202281
pub const POSIX_FADV_DONTNEED: c_int = 4;
@@ -209,6 +288,10 @@ pub const VEOF: usize = 4;
209288
pub const __SIZEOF_PTHREAD_RWLOCK_T: usize = 56;
210289
pub const __SIZEOF_PTHREAD_BARRIER_T: usize = 32;
211290

291+
pub const __NGREG: usize = 48;
292+
pub const __NFPREG: usize = 33;
293+
pub const __NVRREG: usize = 34;
294+
212295
pub const O_APPEND: c_int = 1024;
213296
pub const O_CREAT: c_int = 64;
214297
pub const O_EXCL: c_int = 128;
@@ -970,4 +1053,9 @@ extern "C" {
9701053
newp: *mut c_void,
9711054
newlen: size_t,
9721055
) -> c_int;
1056+
1057+
pub fn getcontext(ucp: *mut ucontext_t) -> c_int;
1058+
pub fn setcontext(ucp: *const ucontext_t) -> c_int;
1059+
pub fn makecontext(ucp: *mut ucontext_t, func: extern "C" fn(), argc: c_int, ...);
1060+
pub fn swapcontext(uocp: *mut ucontext_t, ucp: *const ucontext_t) -> c_int;
9731061
}

0 commit comments

Comments
 (0)