Open Enclave  0.9.0
exception.h
Go to the documentation of this file.
1 // Copyright (c) Open Enclave SDK contributors.
2 // Licensed under the MIT License.
3 
11 #ifndef _OE_BITS_EXCEPTION_H
12 #define _OE_BITS_EXCEPTION_H
13 
14 #include <openenclave/bits/defs.h>
15 #include <openenclave/bits/types.h>
16 
17 OE_EXTERNC_BEGIN
18 
21 #define OE_EXCEPTION_CONTINUE_SEARCH 0x0
22 
25 #define OE_EXCEPTION_CONTINUE_EXECUTION 0xFFFFFFFF
26 
30 #define OE_EXCEPTION_DIVIDE_BY_ZERO 0x0
31 
34 #define OE_EXCEPTION_BREAKPOINT 0x1
35 
38 #define OE_EXCEPTION_BOUND_OUT_OF_RANGE 0x2
39 
42 #define OE_EXCEPTION_ILLEGAL_INSTRUCTION 0x3
43 
46 #define OE_EXCEPTION_ACCESS_VIOLATION 0x4
47 
50 #define OE_EXCEPTION_PAGE_FAULT 0x5
51 
54 #define OE_EXCEPTION_X87_FLOAT_POINT 0x6
55 
58 #define OE_EXCEPTION_MISALIGNMENT 0x7
59 
62 #define OE_EXCEPTION_SIMD_FLOAT_POINT 0x8
63 
66 #define OE_EXCEPTION_UNKNOWN 0xFFFFFFFF
67 
72 #define OE_EXCEPTION_FLAGS_HARDWARE 0x1
73 
77 #define OE_EXCEPTION_FLAGS_SOFTWARE 0x2
78 
82 typedef struct _oe_basic_xstate
83 {
84  uint8_t blob[512];
85 } OE_ALIGNED(16) oe_basic_xstate_t;
92 typedef struct _oe_context
93 {
98  uint64_t flags;
99 
100  uint64_t rax;
102  uint64_t rbx;
104  uint64_t rcx;
106  uint64_t rdx;
108  uint64_t rbp;
110  uint64_t rsp;
112  uint64_t rdi;
114  uint64_t rsi;
116  uint64_t r8;
118  uint64_t r9;
120  uint64_t r10;
122  uint64_t r11;
124  uint64_t r12;
126  uint64_t r13;
128  uint64_t r14;
130  uint64_t r15;
132  uint64_t rip;
134  // Don't need to manipulate the segment registers directly.
135  // Ignore them: CS, DS, ES, SS, GS, and FS.
136 
137  uint32_t mxcsr;
139  oe_basic_xstate_t basic_xstate;
141  // Don't need to manipulate other XSTATE (AVX etc.).
142 } oe_context_t;
149 typedef struct _oe_exception_record
150 {
151  uint32_t code;
153  uint32_t flags;
155  uint64_t address;
170  oe_exception_record_t* exception_context);
171 
172 OE_EXTERNC_END
173 
174 #endif /* _OE_BITS_EXCEPTION_H */
uint64_t r11
Integer register r11.
Definition: exception.h:122
This file defines the types used by the OE SDK.
uint64_t rax
Integer register rax.
Definition: exception.h:100
uint64_t flags
Exception flags.
Definition: exception.h:98
uint64_t rbx
Integer register rbx.
Definition: exception.h:102
uint64_t r14
Integer register r14.
Definition: exception.h:128
uint32_t mxcsr
SSE control flags.
Definition: exception.h:137
uint64_t r10
Integer register r10.
Definition: exception.h:120
uint64_t rcx
Integer register rcx.
Definition: exception.h:104
uint64_t rdi
Integer register rdi.
Definition: exception.h:112
struct _oe_context oe_context_t
Register state to be saved before an exception and restored after the exception has been handled in t...
uint64_t rdx
Integer register rdx.
Definition: exception.h:106
struct _oe_exception_record oe_exception_record_t
Exception context structure with the exception code, flags, address and calling context of the except...
uint64_t r9
Integer register r9.
Definition: exception.h:118
uint64_t r15
Integer register r15.
Definition: exception.h:130
uint64_t(* oe_vectored_exception_handler_t)(oe_exception_record_t *exception_context)
oe_vectored_exception_handler_t - Function pointer for a vectored exception handler in an enclave...
Definition: exception.h:169
oe_basic_xstate_t basic_xstate
Basic XSTATE.
Definition: exception.h:139
uint64_t rsp
Integer register rsp.
Definition: exception.h:110
uint8_t blob[512]
Holds XState i.e.
Definition: exception.h:84
Blob that contains X87 and SSE data.
Definition: exception.h:82
uint32_t flags
Exception flags.
Definition: exception.h:153
struct _oe_basic_xstate OE_ALIGNED(16) oe_basic_xstate_t
Blob that contains X87 and SSE data.
Register state to be saved before an exception and restored after the exception has been handled in t...
Definition: exception.h:92
uint64_t rbp
Integer register rbp.
Definition: exception.h:108
uint64_t address
Exception address.
Definition: exception.h:155
oe_context_t * context
Exception context.
Definition: exception.h:157
uint32_t code
Exception code.
Definition: exception.h:151
uint64_t r12
Integer register r12.
Definition: exception.h:124
uint64_t r8
Integer register r8.
Definition: exception.h:116
uint64_t rsi
Integer register rsi.
Definition: exception.h:114
uint64_t rip
Integer register rip.
Definition: exception.h:132
uint64_t r13
Integer register r13.
Definition: exception.h:126
Exception context structure with the exception code, flags, address and calling context of the except...
Definition: exception.h:149