]> git.llucax.com Git - software/druntime.git/blob - import/core/sys/posix/ucontext.d
Add .gitignore files
[software/druntime.git] / import / core / sys / posix / ucontext.d
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 core.sys.posix.ucontext;
10
11 private import core.sys.posix.config;
12 public import core.sys.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         struct ucontext_t
80         {
81             c_ulong         uc_flags;
82             ucontext_t*     uc_link;
83             stack_t         uc_stack;
84             mcontext_t      uc_mcontext;
85             sigset_t        uc_sigmask;
86             _libc_fpstate   __fpregs_mem;
87         }
88     }
89     else version( X86 )
90     {
91         private
92         {
93             struct _libc_fpreg
94             {
95               ushort[4] significand;
96               ushort    exponent;
97             }
98
99             struct _libc_fpstate
100             {
101               c_ulong           cw;
102               c_ulong           sw;
103               c_ulong           tag;
104               c_ulong           ipoff;
105               c_ulong           cssel;
106               c_ulong           dataoff;
107               c_ulong           datasel;
108               _libc_fpreg[8]    _st;
109               c_ulong           status;
110             }
111
112             const NGREG = 19;
113
114             alias int               greg_t;
115             alias greg_t[NGREG]     gregset_t;
116             alias _libc_fpstate*    fpregset_t;
117         }
118
119         struct mcontext_t
120         {
121             gregset_t   gregs;
122             fpregset_t  fpregs;
123             c_ulong     oldmask;
124             c_ulong     cr2;
125         }
126
127         struct ucontext_t
128         {
129             c_ulong         uc_flags;
130             ucontext_t*     uc_link;
131             stack_t         uc_stack;
132             mcontext_t      uc_mcontext;
133             sigset_t        uc_sigmask;
134             _libc_fpstate   __fpregs_mem;
135         }
136     }
137 }
138
139 //
140 // Obsolescent (OB)
141 //
142 /*
143 int  getcontext(ucontext_t*);
144 void makecontext(ucontext_t*, void function(), int, ...);
145 int  setcontext(in ucontext_t*);
146 int  swapcontext(ucontext_t*, in ucontext_t*);
147 */
148
149 static if( is( ucontext_t ) )
150 {
151     int  getcontext(ucontext_t*);
152     void makecontext(ucontext_t*, void function(), int, ...);
153     int  setcontext(in ucontext_t*);
154     int  swapcontext(ucontext_t*, in ucontext_t*);
155 }