Mercurial > projects > dstep
comparison dstep/coreservices/carboncore/MachineExceptions.d @ 11:07194b026fa4
Added bindings to a couple of frameworks, new license + some other things
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sat, 01 Aug 2009 15:03:28 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
10:27e00625790b | 11:07194b026fa4 |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Jul 21, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.coreservices.carboncore.MachineExceptions; | |
8 | |
9 //import dstep.AvailabilityMacros; | |
10 import dstep.coreservices.carboncore.MacTypes; | |
11 import dstep.coreservices.carboncore.MixedMode; | |
12 import dstep.internal.Types; | |
13 import dstep.internal.Version; | |
14 //import dstep.xmmintrin; | |
15 | |
16 struct OpaqueAreaID; | |
17 | |
18 alias OpaqueAreaID* AreaID; | |
19 alias uint MemoryReferenceKind; | |
20 alias uint ExceptionKind; | |
21 alias MachineInformationIntel MachineInformation; | |
22 alias RegisterInformationIntel RegisterInformation; | |
23 alias FPUInformationIntel FPUInformation; | |
24 alias VectorInformationIntel VectorInformation; | |
25 alias ExceptionHandlerProcPtr ExceptionHandlerUPP; | |
26 alias ExceptionHandlerUPP ExceptionHandlerTPP; | |
27 alias ExceptionHandlerTPP ExceptionHandler; | |
28 alias ubyte[10] FPRegIntel; | |
29 | |
30 extern (C) | |
31 { | |
32 alias int function (ExceptionInformation*) ExceptionHandlerProcPtr; | |
33 } | |
34 | |
35 enum | |
36 { | |
37 kWriteReference = 0, | |
38 kReadReference = 1, | |
39 kFetchReference = 2, | |
40 writeReference = kWriteReference, | |
41 readReference = kReadReference, | |
42 fetchReference = kFetchReference | |
43 } | |
44 | |
45 enum | |
46 { | |
47 kUnknownException = 0, | |
48 kIllegalInstructionException = 1, | |
49 kTrapException = 2, | |
50 kAccessException = 3, | |
51 kUnmappedMemoryException = 4, | |
52 kExcludedMemoryException = 5, | |
53 kReadOnlyMemoryException = 6, | |
54 kUnresolvablePageFaultException = 7, | |
55 kPrivilegeViolationException = 8, | |
56 kTraceException = 9, | |
57 kInstructionBreakpointException = 10, | |
58 kDataBreakpointException = 11, | |
59 kIntegerException = 12, | |
60 kFloatingPointException = 13, | |
61 kStackOverflowException = 14, | |
62 kTaskTerminationException = 15, | |
63 kTaskCreationException = 16, | |
64 kDataAlignmentException = 17 | |
65 } | |
66 | |
67 union Vector128 | |
68 { | |
69 c_ulong[4] l; | |
70 ushort[8] s; | |
71 ubyte[16] c; | |
72 } | |
73 | |
74 union ExceptionInfo | |
75 { | |
76 MemoryExceptionInformation* memoryInfo; | |
77 } | |
78 | |
79 static if (X86 || X86_64) | |
80 { | |
81 union Vector128Intel | |
82 { | |
83 float s; | |
84 int si; | |
85 int sd; | |
86 ubyte[16] c; | |
87 } | |
88 } | |
89 | |
90 struct MachineInformationPowerPC | |
91 { | |
92 UnsignedWide CTR; | |
93 UnsignedWide LR; | |
94 UnsignedWide PC; | |
95 uint CRRegister; | |
96 uint XER; | |
97 uint MSR; | |
98 uint MQ; | |
99 uint ExceptKind; | |
100 uint DSISR; | |
101 UnsignedWide DAR; | |
102 UnsignedWide Reserved; | |
103 } | |
104 | |
105 | |
106 struct RegisterInformationPowerPC | |
107 { | |
108 UnsignedWide R0; | |
109 UnsignedWide R1; | |
110 UnsignedWide R2; | |
111 UnsignedWide R3; | |
112 UnsignedWide R4; | |
113 UnsignedWide R5; | |
114 UnsignedWide R6; | |
115 UnsignedWide R7; | |
116 UnsignedWide R8; | |
117 UnsignedWide R9; | |
118 UnsignedWide R10; | |
119 UnsignedWide R11; | |
120 UnsignedWide R12; | |
121 UnsignedWide R13; | |
122 UnsignedWide R14; | |
123 UnsignedWide R15; | |
124 UnsignedWide R16; | |
125 UnsignedWide R17; | |
126 UnsignedWide R18; | |
127 UnsignedWide R19; | |
128 UnsignedWide R20; | |
129 UnsignedWide R21; | |
130 UnsignedWide R22; | |
131 UnsignedWide R23; | |
132 UnsignedWide R24; | |
133 UnsignedWide R25; | |
134 UnsignedWide R26; | |
135 UnsignedWide R27; | |
136 UnsignedWide R28; | |
137 UnsignedWide R29; | |
138 UnsignedWide R30; | |
139 UnsignedWide R31; | |
140 } | |
141 | |
142 | |
143 struct FPUInformationPowerPC | |
144 { | |
145 UnsignedWide* Registers; | |
146 uint FPSCR; | |
147 uint Reserved; | |
148 } | |
149 | |
150 | |
151 struct VectorInformationPowerPC | |
152 { | |
153 Vector128* Registers; | |
154 Vector128 VSCR; | |
155 uint VRsave; | |
156 } | |
157 | |
158 | |
159 struct MemoryExceptionInformation | |
160 { | |
161 AreaID theArea; | |
162 LogicalAddress theAddress; | |
163 int theError; | |
164 uint theReference; | |
165 } | |
166 | |
167 | |
168 struct ExceptionInformationPowerPC | |
169 { | |
170 uint theKind; | |
171 MachineInformationPowerPC* machineState; | |
172 RegisterInformationPowerPC* registerImage; | |
173 FPUInformationPowerPC* FPUImage; | |
174 ExceptionInfo info; | |
175 VectorInformationPowerPC* vectorImage; | |
176 } | |
177 | |
178 | |
179 struct MachineInformationIntel | |
180 { | |
181 uint CS; | |
182 uint DS; | |
183 uint SS; | |
184 uint ES; | |
185 uint FS; | |
186 uint GS; | |
187 uint EFLAGS; | |
188 uint EIP; | |
189 uint ExceptTrap; | |
190 uint ExceptErr; | |
191 uint ExceptAddr; | |
192 } | |
193 | |
194 | |
195 struct RegisterInformationIntel | |
196 { | |
197 uint EAX; | |
198 uint EBX; | |
199 uint ECX; | |
200 uint EDX; | |
201 uint ESI; | |
202 uint EDI; | |
203 uint EBP; | |
204 uint ESP; | |
205 } | |
206 | |
207 | |
208 struct FPUInformationIntel | |
209 { | |
210 FPRegIntel* Registers; | |
211 ushort Control; | |
212 ushort Status; | |
213 ushort Tag; | |
214 ushort Opcode; | |
215 uint EIP; | |
216 uint DP; | |
217 uint DS; | |
218 } | |
219 | |
220 | |
221 struct VectorInformationIntel | |
222 { | |
223 Vector128Intel* Registers; | |
224 } | |
225 | |
226 | |
227 struct ExceptionInformation | |
228 { | |
229 uint theKind; | |
230 MachineInformation* machineState; | |
231 RegisterInformation* registerImage; | |
232 FPUInformation* FPUImage; | |
233 ExceptionInfo info; | |
234 VectorInformation* vectorImage; | |
235 } | |
236 | |
237 extern (C) | |
238 { | |
239 ExceptionHandlerUPP NewExceptionHandlerUPP (ExceptionHandlerProcPtr userRoutine); | |
240 void DisposeExceptionHandlerUPP (ExceptionHandlerUPP userUPP); | |
241 int InvokeExceptionHandlerUPP (ExceptionInformation* theException, ExceptionHandlerUPP userUPP); | |
242 ExceptionHandlerTPP InstallExceptionHandler (ExceptionHandlerTPP theHandler); | |
243 } |