]> git.buserror.net Git - polintos/scott/priv.git/blob - idl/exceptions.idl
Add first draft of marshalling spec
[polintos/scott/priv.git] / idl / exceptions.idl
1 // System exceptions
2 //
3 // These are all of the exceptions that derive from SystemException, 
4 // which can implicitly be thrown from any method.
5 //
6 // Common fields:
7 //   exp: explanation string, may be NULL
8 //   param: index (starting from 0) of the parameter which is causing
9 //          the problem, or -1 if unspecified.  This should only be
10 //          specified for parameters of IDL methods; if thrown from a
11 //          language function/method which does not know the relevant
12 //          parameter in the IDL method, it should use an explanation
13 //          string instead (and not use the index of its own parameter).
14
15 namespace Exceptions;
16
17 // The base Exception struct; all exceptions derive from this.
18 struct Exception virtual {
19         guid: "D88F50D2-2877-11DA-84AD-00112431A05E";
20
21         // The previous exception frame (i.e. that which threw this one),
22         // or null for the original exception frame.  Linkage shall be
23         // preserved whenever an exception is either propagated or
24         // raised within an exception handling block.
25            
26         Exception prev;
27
28         // Object and method of the thrower of this frame, if it was rethrown
29         // due to crossing an IDL method boundary.  Otherwise, both fields are
30         // null.
31            
32         Object object;
33 //      Method method; // Fix throw_idl when this is uncommented.
34         
35         // Language and machine specific information about whence an exception
36         // was thrown.
37         
38         ExceptionOriginInfo origin;
39 };
40
41 struct ExceptionOriginInfo virtual {
42         guid: "DBCF8333-2877-11DA-B66E-00112431A05E";
43 };
44
45 // This struct, or one derived from it, shall be used for an
46 // exception's origin field if it is from native code (and
47 // thus can refer to instructions by machine address).
48    
49 struct NativeCodeExceptionOriginInfo : ExceptionOriginInfo {
50         guid: "E1B3FAC6-2877-11DA-8493-00112431A05E";
51
52         // Address of the faulting or throwing instruction
53         ulong pc;
54 };
55
56 namespace Std;
57
58 struct SystemException : Exception {
59         guid: "E5204D31-2877-11DA-A833-00112431A05E";
60         
61         bitfield Flags:32 {
62                 // Exception was thrown by the kernel.  This bit is stripped when
63                 // the exception passes through the ORB.  It can be used to verify
64                 // that MemoryFault and similar exceptions refer to an actual fault
65                 // of the current address space when deciding whether to abort the
66                 // process.
67
68                 Kernel,
69                 
70                 // Exception was generated automatically by the ORB, rather than
71                 // thrown by a method.  Some types of exceptions have fixed
72                 // explanation string formats (and possibly other field usages) for
73                 // ORB generated exceptions, but a free form explanation field for
74                 // method-thrown exceptions.
75                 
76                 ORB
77         } flags;
78 };
79
80
81 // The MemoryFault exception indicates that the throwing method
82 // attempted to perform an invalid memory access, and the MemoryFault
83 // trap was not handled by the faulting process.
84
85 struct MemoryFault : SystemException {
86         guid: "EAA266EC-2877-11DA-9C5D-00112431A05E";
87
88         // Address that the method tried to access
89         ulong addr;             
90
91         // Address of the faulting instruction, 0 if from kernel
92         ulong pc;
93
94         // Process of faulting method
95         Proc.Process proc;
96
97         // Architecture specific data
98         ArchMemoryFault arch;   
99
100         enum Type {
101                 // The fault occured on a memory load
102                 Load,
103                 
104                 // The fault occured on a memory store
105                 Store,
106                 
107                 // The fault occured on an instruction fetch
108                 IFetch
109         } type;
110         
111         enum Cause {
112                 // The faulting address was not mapped
113                 Unmapped,       
114                 
115                 // The requested operation was prohibited
116                 Protected,      
117                 
118                 // An I/O error occured accessing a memory mapped region, or an
119                 // uncorrectable memory error was encountered.
120                 IOError,
121         };
122 };
123
124 struct ArchMemoryFault virtual
125 {
126         guid: "EF25EED2-2877-11DA-83EF-00112431A05E";
127 };
128
129 // The OutOfMemory exception indicates that insufficient physical memory
130 // is available to perform the requested operation, including implicit
131 // allocations of memory such as memory mapped accesses, shared copy on
132 // write regions, and zero pages (though implicit allocation failures
133 // cannot happen unless overcommit is enabled).  This exception is only
134 // thrown after a System.Traps.ReduceMemoryUsage trap has been delivered
135 // and failed to free sufficient memory.
136
137 struct OutOfMemory : SystemException {
138         guid: "F21A198C-2877-11DA-92DB-00112431A05E";
139 };
140
141 // Like OutOfMemory, but indicates that disk space, virtual
142 // address space, etc. has been exhausted.
143
144 struct OutOfSpace : SystemException {
145         guid: "6267B5C2-D2E4-11DA-831C-00112431A05E";
146         char[] exp immutable;
147 };
148
149 // Like OutOfSpace, but indicates that a specific requested resource
150 // (such as an IRQ number or network port) is already in use.  Use
151 // OutOfSpace instead for resources that are allocated rather than
152 // claimed.
153
154 struct ResourceBusy : SystemException {
155         guid: "0EFB88FC-2878-11DA-AEB9-00112431A05E";
156         
157         int param;  // Index of parameter with problem, or -1 if
158                     // unspecified, or if not due to a bad param.
159         char[] exp immutable;
160 };
161
162 /* The InstrFault exception indicates that the throwing method tried
163    to execute an invalid or privileged instruction, and the
164    InstrFault trap was not handled by the faulting process. */
165
166 struct InstrFault : SystemException {
167         guid: "F5CAE5F8-2877-11DA-BB6C-00112431A05E";
168
169         // Address of the faulting instruction
170         ulong pc;
171
172         // Process of faulting method
173         Proc.Process proc;
174
175         // Architecture specific data
176         ArchInstrFault arch;
177 };
178
179 struct ArchInstrFault virtual
180 {
181         guid: "F9CE2A55-2877-11DA-9C92-00112431A05E";
182 };
183
184 struct Token {
185 };
186
187 // The TokenFault exception indicates that the caller does not
188 // currently have the necessary token to complete the requested method.
189
190 struct TokenFault : SystemException {
191         guid: "011B018D-2878-11DA-9F80-00112431A05E";
192
193         Token token;     // Token that is required but not present
194
195         enum Type {
196                 Thrown,      // The TokenFault was explicitly thrown by a 
197                              // called method
198                 Call,        // The token was required for a method call
199                 Open,        // The token was required to obtain a handle on
200                              // the object
201         } type;
202
203         bitfield Flags:32 {
204                 restartable:1   // The method may be restarted if the requested
205                                 // token is acquired.  Any TokenFaults with this
206                                 // flag set are handled in a transparent manner,
207                                 // by either acquiring the token and retrying or
208                                 // clearing the bit and propagating.  Any method
209                                 // that throws a restartable TokenFault must
210                                 // be cleanly restartable with no side effects.
211         };
212
213         // For Call and Open, this is the object associated with the prohibited
214         // operation.  Explicitly thrown token faults may optionally use this
215         // field.
216         
217         Object object;
218
219         // For Call, this is the method that could not be called.  Explicitly
220         // thrown token faults may optionally use this field.
221
222 //      Method method; // Fix throw_idl when this is uncommented.
223
224         char[] exp immutable;
225 };
226
227 // InvalidArgument may be thrown when an argument or combination
228 // of arguments is invalid.
229
230 struct InvalidArgument : SystemException {
231         guid: "04865176-2878-11DA-9F87-00112431A05E";
232
233         int param;  // Index of problematic parameter, counting from 0,
234                     // or -1 if not specified.
235         char[] exp immutable;
236 };
237
238 // GeneralFailure, as the name implies, is a general purpose exception
239 // to indicate failure conditions not covered by existing exceptions.
240 // It is generally preferable to define a specific exception for
241 // forseeable causes of failure.
242
243 struct GeneralFailure : SystemException {
244         guid: "094C37A1-2878-11DA-914D-00112431A05E";
245         
246         char[] exp immutable;
247 };
248
249 // InvalidState is thrown when a method is called on an object which
250 // is not in a state in which the operation is meaningful.
251
252 struct InvalidState : SystemException {
253         guid: "0C361FFF-2878-11DA-ABC1-00112431A05E";
254         
255         char[] exp immutable;
256 };
257
258
259 struct OperationNotSupported : SystemException {
260         guid: "119C274E-2878-11DA-B3B2-00112431A05E";
261         
262         char[] exp immutable;
263 };
264
265 // InvalidReference is thrown when a method is called on a reference
266 // that no longer points to a valid object, or if such a dangling
267 // reference is found in the method's parameters.
268
269 struct InvalidReference : SystemException {
270         guid: "16E5E64F-2878-11DA-916E-00112431A05E";
271
272         int param;  // Index of parameter with problem, or -1 if the method
273                     // was invoked on a dangling reference.  If the invalid
274                     // reference is in the object's internal state, then
275                     // InvalidState should be thrown instead.
276                            
277         char[] exp immutable; 
278                     // When thrown by the ORB, NULL if param is -1 or if the
279                     // dangling reference was passed directly as a parameter. 
280                     // If, however, the dangling reference was in a struct,
281                     // this provides the path to the bad parameter (e.g. if
282                     // the third parameter of a method is a struct with a
283                     // member "foo", and "foo" is a struct with a member
284                     // "bar", and bar is a dangling object reference, exp will
285                     // contain "foo.bar").
286                     //
287                     // When not thrown by the ORB, this is a free form
288                     // explanation field (and may be NULL).
289 };
290
291 // Thrown when more references are attempted to be dropped than exist.
292 // "refs" is the number of references, and "released" is the number
293 // of releases asked for.
294
295 struct RefCountException : SystemException {
296         guid: "1EEDC277-9D71-415E-AA8D-19C52FDB72F2";
297         
298         int refs, released;
299 };