comparison druntime/import/core/sys/posix/ucontext.d @ 1458:e0b2d67cfe7c

Added druntime (this should be removed once it works).
author Robert Clipsham <robert@octarineparrot.com>
date Tue, 02 Jun 2009 17:43:06 +0100
parents
children
comparison
equal deleted inserted replaced
1456:7b218ec1044f 1458:e0b2d67cfe7c
1 /**
2 * D header file for POSIX.
3 *
4 * Copyright: Copyright Sean Kelly 2005 - 2009.
5 * License: <a href="http://www.boost.org/LICENSE_1_0.txt>Boost License 1.0</a>.
6 * Authors: Sean Kelly
7 * Standards: The Open Group Base Specifications Issue 6, IEEE Std 1003.1, 2004 Edition
8 *
9 * Copyright Sean Kelly 2005 - 2009.
10 * Distributed under the Boost Software License, Version 1.0.
11 * (See accompanying file LICENSE_1_0.txt or copy at
12 * http://www.boost.org/LICENSE_1_0.txt)
13 */
14 module core.sys.posix.ucontext;
15
16 private import core.sys.posix.config;
17 public import core.sys.posix.signal; // for sigset_t, stack_t
18
19 extern (C):
20
21 //
22 // XOpen (XSI)
23 //
24 /*
25 mcontext_t
26
27 struct ucontext_t
28 {
29 ucontext_t* uc_link;
30 sigset_t uc_sigmask;
31 stack_t uc_stack;
32 mcontext_t uc_mcontext;
33 }
34 */
35
36 version( linux )
37 {
38
39 version( X86_64 )
40 {
41 private
42 {
43 struct _libc_fpxreg
44 {
45 ushort[4] significand;
46 ushort exponent;
47 ushort[3] padding;
48 }
49
50 struct _libc_xmmreg
51 {
52 uint[4] element;
53 }
54
55 struct _libc_fpstate
56 {
57 ushort cwd;
58 ushort swd;
59 ushort ftw;
60 ushort fop;
61 ulong rip;
62 ulong rdp;
63 uint mxcsr;
64 uint mxcr_mask;
65 _libc_fpxreg[8] _st;
66 _libc_xmmreg[16] _xmm;
67 uint[24] padding;
68 }
69
70 enum NGREG = 23;
71
72 alias c_long greg_t;
73 alias greg_t[NGREG] gregset_t;
74 alias _libc_fpstate* fpregset_t;
75 }
76
77 struct mcontext_t
78 {
79 gregset_t gregs;
80 fpregset_t fpregs;
81 c_ulong[8] __reserved1;
82 }
83
84 struct ucontext_t
85 {
86 c_ulong uc_flags;
87 ucontext_t* uc_link;
88 stack_t uc_stack;
89 mcontext_t uc_mcontext;
90 sigset_t uc_sigmask;
91 _libc_fpstate __fpregs_mem;
92 }
93 }
94 else version( X86 )
95 {
96 private
97 {
98 struct _libc_fpreg
99 {
100 ushort[4] significand;
101 ushort exponent;
102 }
103
104 struct _libc_fpstate
105 {
106 c_ulong cw;
107 c_ulong sw;
108 c_ulong tag;
109 c_ulong ipoff;
110 c_ulong cssel;
111 c_ulong dataoff;
112 c_ulong datasel;
113 _libc_fpreg[8] _st;
114 c_ulong status;
115 }
116
117 enum NGREG = 19;
118
119 alias int greg_t;
120 alias greg_t[NGREG] gregset_t;
121 alias _libc_fpstate* fpregset_t;
122 }
123
124 struct mcontext_t
125 {
126 gregset_t gregs;
127 fpregset_t fpregs;
128 c_ulong oldmask;
129 c_ulong cr2;
130 }
131
132 struct ucontext_t
133 {
134 c_ulong uc_flags;
135 ucontext_t* uc_link;
136 stack_t uc_stack;
137 mcontext_t uc_mcontext;
138 sigset_t uc_sigmask;
139 _libc_fpstate __fpregs_mem;
140 }
141 }
142 }
143
144 //
145 // Obsolescent (OB)
146 //
147 /*
148 int getcontext(ucontext_t*);
149 void makecontext(ucontext_t*, void function(), int, ...);
150 int setcontext(in ucontext_t*);
151 int swapcontext(ucontext_t*, in ucontext_t*);
152 */
153
154 static if( is( ucontext_t ) )
155 {
156 int getcontext(ucontext_t*);
157 void makecontext(ucontext_t*, void function(), int, ...);
158 int setcontext(in ucontext_t*);
159 int swapcontext(ucontext_t*, in ucontext_t*);
160 }