@@ -25,6 +25,8 @@ pub type sem_t = *mut sem;
2525pub type cpuset_t = cpumask_t ;
2626pub type cpu_set_t = cpumask_t ;
2727
28+ pub type register_t = :: c_long ;
29+
2830#[ cfg_attr( feature = "extra_traits" , derive( Debug ) ) ]
2931pub enum sem { }
3032impl :: Copy for sem { }
@@ -253,6 +255,51 @@ s_no_extra_traits! {
253255 pub sigev_value: :: sigval,
254256 __unused3: * mut :: c_void //actually a function pointer
255257 }
258+
259+ pub struct mcontext_t {
260+ pub mc_onstack: register_t,
261+ pub mc_rdi: register_t,
262+ pub mc_rsi: register_t,
263+ pub mc_rdx: register_t,
264+ pub mc_rcx: register_t,
265+ pub mc_r8: register_t,
266+ pub mc_r9: register_t,
267+ pub mc_rax: register_t,
268+ pub mc_rbx: register_t,
269+ pub mc_rbp: register_t,
270+ pub mc_r10: register_t,
271+ pub mc_r11: register_t,
272+ pub mc_r12: register_t,
273+ pub mc_r13: register_t,
274+ pub mc_r14: register_t,
275+ pub mc_r15: register_t,
276+ pub mc_xflags: register_t,
277+ pub mc_trapno: register_t,
278+ pub mc_addr: register_t,
279+ pub mc_flags: register_t,
280+ pub mc_err: register_t,
281+ pub mc_rip: register_t,
282+ pub mc_cs: register_t,
283+ pub mc_rflags: register_t,
284+ pub mc_rsp: register_t,
285+ pub mc_ss: register_t,
286+ pub mc_len: :: c_uint,
287+ pub mc_fpformat: :: c_uint,
288+ pub mc_ownedfp: :: c_uint,
289+ __reserved: :: c_uint,
290+ __unused: [ :: c_uint; 8 ] ,
291+ pub mc_fpregs: [ [ :: c_uint; 8 ] ; 32 ] ,
292+ }
293+
294+ pub struct ucontext_t {
295+ pub uc_sigmask: :: sigset_t,
296+ pub uc_mcontext: mcontext_t,
297+ pub uc_link: * mut ucontext_t,
298+ pub uc_stack: stack_t,
299+ pub uc_cofunc: :: Option <unsafe extern "C" fn ( uc: * mut ucontext_t, arg: * mut :: c_void) >,
300+ pub uc_arg: * mut :: c_void,
301+ __pad: [ :: c_int; 4 ] ,
302+ }
256303}
257304
258305cfg_if ! {
@@ -452,6 +499,100 @@ cfg_if! {
452499 self . sigev_value. hash( state) ;
453500 }
454501 }
502+ impl PartialEq for mcontext_t {
503+ fn eq( & self , other: & mcontext_t) -> bool {
504+ self . mc_onstack == other. mc_onstack &&
505+ self . mc_rdi == other. mc_rdi &&
506+ self . mc_rsi == other. mc_rsi &&
507+ self . mc_rdx == other. mc_rdx &&
508+ self . mc_rcx == other. mc_rcx &&
509+ self . mc_r8 == other. mc_r8 &&
510+ self . mc_r9 == other. mc_r9 &&
511+ self . mc_rax == other. mc_rax &&
512+ self . mc_rbx == other. mc_rbx &&
513+ self . mc_rbp == other. mc_rbp &&
514+ self . mc_r10 == other. mc_r10 &&
515+ self . mc_r11 == other. mc_r11 &&
516+ self . mc_r12 == other. mc_r12 &&
517+ self . mc_r13 == other. mc_r13 &&
518+ self . mc_r14 == other. mc_r14 &&
519+ self . mc_r15 == other. mc_r15 &&
520+ self . mc_xflags == other. mc_xflags &&
521+ self . mc_trapno == other. mc_trapno &&
522+ self . mc_addr == other. mc_addr &&
523+ self . mc_flags == other. mc_flags &&
524+ self . mc_err == other. mc_err &&
525+ self . mc_rip == other. mc_rip &&
526+ self . mc_cs == other. mc_cs &&
527+ self . mc_rflags == other. mc_rflags &&
528+ self . mc_rsp == other. mc_rsp &&
529+ self . mc_ss == other. mc_ss &&
530+ self . mc_len == other. mc_len &&
531+ self . mc_fpformat == other. mc_fpformat &&
532+ self . mc_ownedfp == other. mc_ownedfp
533+ // FIXME: self.mc_fpregs == other.mc_fpregs
534+ }
535+ }
536+ impl Eq for mcontext_t { }
537+ impl :: fmt:: Debug for mcontext_t {
538+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
539+ f. debug_struct( "mcontext_t" )
540+ . field( "mc_onstack" , & self . mc_onstack)
541+ . field( "mc_rdi" , & self . mc_rdi)
542+ . field( "mc_rsi" , & self . mc_rsi)
543+ . field( "mc_rdx" , & self . mc_rdx)
544+ . field( "mc_rcx" , & self . mc_rcx)
545+ . field( "mc_r8" , & self . mc_r8)
546+ . field( "mc_r9" , & self . mc_r9)
547+ . field( "mc_rax" , & self . mc_rax)
548+ . field( "mc_rbx" , & self . mc_rbx)
549+ . field( "mc_rbp" , & self . mc_rbp)
550+ . field( "mc_r10" , & self . mc_r10)
551+ . field( "mc_r11" , & self . mc_r11)
552+ . field( "mc_r12" , & self . mc_r12)
553+ . field( "mc_r13" , & self . mc_r13)
554+ . field( "mc_r14" , & self . mc_r14)
555+ . field( "mc_r15" , & self . mc_r15)
556+ . field( "mc_xflags" , & self . mc_xflags)
557+ . field( "mc_trapno" , & self . mc_trapno)
558+ . field( "mc_addr" , & self . mc_addr)
559+ . field( "mc_flags" , & self . mc_flags)
560+ . field( "mc_err" , & self . mc_err)
561+ . field( "mc_rip" , & self . mc_rip)
562+ . field( "mc_cs" , & self . mc_cs)
563+ . field( "mc_rflags" , & self . mc_rflags)
564+ . field( "mc_rsp" , & self . mc_rsp)
565+ . field( "mc_ss" , & self . mc_ss)
566+ . field( "mc_len" , & self . mc_len)
567+ . field( "mc_fpformat" , & self . mc_fpformat)
568+ . field( "mc_ownedfp" , & self . mc_ownedfp)
569+ // FIXME: .field("mc_fpregs", &self.mc_fpregs)
570+ . finish( )
571+ }
572+ }
573+ impl PartialEq for ucontext_t {
574+ fn eq( & self , other: & ucontext_t) -> bool {
575+ self . uc_sigmask == other. uc_sigmask
576+ && self . uc_mcontext == other. uc_mcontext
577+ && self . uc_link == other. uc_link
578+ && self . uc_stack == other. uc_stack
579+ && self . uc_cofunc == other. uc_cofunc
580+ && self . uc_arg == other. uc_arg
581+ }
582+ }
583+ impl Eq for ucontext_t { }
584+ impl :: fmt:: Debug for ucontext_t {
585+ fn fmt( & self , f: & mut :: fmt:: Formatter ) -> :: fmt:: Result {
586+ f. debug_struct( "ucontext_t" )
587+ . field( "uc_sigmask" , & self . uc_sigmask)
588+ . field( "uc_mcontext" , & self . uc_mcontext)
589+ . field( "uc_link" , & self . uc_link)
590+ . field( "uc_stack" , & self . uc_stack)
591+ . field( "uc_cofunc" , & self . uc_cofunc)
592+ . field( "uc_arg" , & self . uc_arg)
593+ . finish( )
594+ }
595+ }
455596 }
456597}
457598
0 commit comments