132
|
1 /**
|
|
2 * D header file for POSIX.
|
|
3 *
|
|
4 * Copyright: Public Domain
|
|
5 * License: Public Domain
|
|
6 * Authors: Sean Kelly
|
|
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
|
|
8 */
|
|
9 module tango.stdc.posix.ucontext;
|
|
10
|
|
11 private import tango.stdc.posix.config;
|
|
12 public import tango.stdc.posix.signal; // for sigset_t, stack_t
|
|
13
|
|
14 extern (C):
|
|
15
|
|
16 //
|
|
17 // XOpen (XSI)
|
|
18 //
|
|
19 /*
|
|
20 mcontext_t
|
|
21
|
|
22 struct ucontext_t
|
|
23 {
|
|
24 ucontext_t* uc_link;
|
|
25 sigset_t uc_sigmask;
|
|
26 stack_t uc_stack;
|
|
27 mcontext_t uc_mcontext;
|
|
28 }
|
|
29 */
|
|
30
|
|
31 version( linux )
|
|
32 {
|
|
33
|
|
34 version( X86_64 )
|
|
35 {
|
|
36 private
|
|
37 {
|
|
38 struct _libc_fpxreg
|
|
39 {
|
|
40 ushort[4] significand;
|
|
41 ushort exponent;
|
|
42 ushort[3] padding;
|
|
43 }
|
|
44
|
|
45 struct _libc_xmmreg
|
|
46 {
|
|
47 uint[4] element;
|
|
48 }
|
|
49
|
|
50 struct _libc_fpstate
|
|
51 {
|
|
52 ushort cwd;
|
|
53 ushort swd;
|
|
54 ushort ftw;
|
|
55 ushort fop;
|
|
56 ulong rip;
|
|
57 ulong rdp;
|
|
58 uint mxcsr;
|
|
59 uint mxcr_mask;
|
|
60 _libc_fpxreg[8] _st;
|
|
61 _libc_xmmreg[16] _xmm;
|
|
62 uint[24] padding;
|
|
63 }
|
|
64
|
|
65 const NGREG = 23;
|
|
66
|
|
67 alias c_long greg_t;
|
|
68 alias greg_t[NGREG] gregset_t;
|
|
69 alias _libc_fpstate* fpregset_t;
|
|
70 }
|
|
71
|
|
72 struct mcontext_t
|
|
73 {
|
|
74 gregset_t gregs;
|
|
75 fpregset_t fpregs;
|
|
76 c_ulong[8] __reserved1;
|
|
77 }
|
|
78 }
|
|
79 else version( X86 )
|
|
80 {
|
|
81 private
|
|
82 {
|
|
83 struct _libc_fpreg
|
|
84 {
|
|
85 ushort[4] significand;
|
|
86 ushort exponent;
|
|
87 }
|
|
88
|
|
89 struct _libc_fpstate
|
|
90 {
|
|
91 c_ulong cw;
|
|
92 c_ulong sw;
|
|
93 c_ulong tag;
|
|
94 c_ulong ipoff;
|
|
95 c_ulong cssel;
|
|
96 c_ulong dataoff;
|
|
97 c_ulong datasel;
|
|
98 _libc_fpreg[8] _st;
|
|
99 c_ulong status;
|
|
100 }
|
|
101
|
|
102 const NGREG = 19;
|
|
103
|
|
104 alias int greg_t;
|
|
105 alias greg_t[NGREG] gregset_t;
|
|
106 alias _libc_fpstate* fpregset_t;
|
|
107 }
|
|
108
|
|
109 struct mcontext_t
|
|
110 {
|
|
111 gregset_t gregs;
|
|
112 fpregset_t fpregs;
|
|
113 c_ulong oldmask;
|
|
114 c_ulong cr2;
|
|
115 }
|
|
116
|
|
117 struct ucontext_t
|
|
118 {
|
|
119 c_ulong uc_flags;
|
|
120 ucontext_t* uc_link;
|
|
121 stack_t uc_stack;
|
|
122 mcontext_t uc_mcontext;
|
|
123 sigset_t uc_sigmask;
|
|
124 _libc_fpstate __fpregs_mem;
|
|
125 }
|
|
126 }
|
|
127 }
|
|
128
|
|
129 //
|
|
130 // Obsolescent (OB)
|
|
131 //
|
|
132 /*
|
|
133 int getcontext(ucontext_t*);
|
|
134 void makecontext(ucontext_t*, void function(), int, ...);
|
|
135 int setcontext(ucontext_t*);
|
|
136 int swapcontext(ucontext_t*, ucontext_t*);
|
|
137 */
|
|
138
|
|
139 static if( is( typeof( ucontext_t ) ) )
|
|
140 {
|
|
141 int getcontext(ucontext_t*);
|
|
142 void makecontext(ucontext_t*, void function(), int, ...);
|
|
143 int setcontext(ucontext_t*);
|
|
144 int swapcontext(ucontext_t*, ucontext_t*);
|
|
145 }
|