gitlab.com/Raven-IO/raven-delve@v1.22.4/pkg/proc/native/exc.h (about) 1 #ifndef _exc_user_ 2 #define _exc_user_ 3 4 /* Module exc */ 5 6 #include <string.h> 7 #include <mach/ndr.h> 8 #include <mach/boolean.h> 9 #include <mach/kern_return.h> 10 #include <mach/notify.h> 11 #include <mach/mach_types.h> 12 #include <mach/message.h> 13 #include <mach/mig_errors.h> 14 #include <mach/port.h> 15 16 /* BEGIN VOUCHER CODE */ 17 18 #ifndef KERNEL 19 #if defined(__has_include) 20 #if __has_include(<mach/mig_voucher_support.h>) 21 #ifndef USING_VOUCHERS 22 #define USING_VOUCHERS 23 #endif 24 #ifndef __VOUCHER_FORWARD_TYPE_DECLS__ 25 #define __VOUCHER_FORWARD_TYPE_DECLS__ 26 #ifdef __cplusplus 27 extern "C" { 28 #endif 29 extern boolean_t voucher_mach_msg_set(mach_msg_header_t *msg) __attribute__((weak_import)); 30 #ifdef __cplusplus 31 } 32 #endif 33 #endif // __VOUCHER_FORWARD_TYPE_DECLS__ 34 #endif // __has_include(<mach/mach_voucher_types.h>) 35 #endif // __has_include 36 #endif // !KERNEL 37 38 /* END VOUCHER CODE */ 39 40 41 #ifdef AUTOTEST 42 #ifndef FUNCTION_PTR_T 43 #define FUNCTION_PTR_T 44 typedef void (*function_ptr_t)(mach_port_t, char *, mach_msg_type_number_t); 45 typedef struct { 46 char *name; 47 function_ptr_t function; 48 } function_table_entry; 49 typedef function_table_entry *function_table_t; 50 #endif /* FUNCTION_PTR_T */ 51 #endif /* AUTOTEST */ 52 53 #ifndef exc_MSG_COUNT 54 #define exc_MSG_COUNT 3 55 #endif /* exc_MSG_COUNT */ 56 57 #include <mach/std_types.h> 58 #include <mach/mig.h> 59 #include <mach/mig.h> 60 #include <mach/mach_types.h> 61 62 #ifdef __BeforeMigUserHeader 63 __BeforeMigUserHeader 64 #endif /* __BeforeMigUserHeader */ 65 66 #include <sys/cdefs.h> 67 __BEGIN_DECLS 68 69 70 /* Routine exception_raise */ 71 #ifdef mig_external 72 mig_external 73 #else 74 extern 75 #endif /* mig_external */ 76 kern_return_t exception_raise 77 ( 78 mach_port_t exception_port, 79 mach_port_t thread, 80 mach_port_t task, 81 exception_type_t exception, 82 exception_data_t code, 83 mach_msg_type_number_t codeCnt 84 ); 85 86 /* Routine exception_raise_state */ 87 #ifdef mig_external 88 mig_external 89 #else 90 extern 91 #endif /* mig_external */ 92 kern_return_t exception_raise_state 93 ( 94 mach_port_t exception_port, 95 exception_type_t exception, 96 const exception_data_t code, 97 mach_msg_type_number_t codeCnt, 98 int *flavor, 99 const thread_state_t old_state, 100 mach_msg_type_number_t old_stateCnt, 101 thread_state_t new_state, 102 mach_msg_type_number_t *new_stateCnt 103 ); 104 105 /* Routine exception_raise_state_identity */ 106 #ifdef mig_external 107 mig_external 108 #else 109 extern 110 #endif /* mig_external */ 111 kern_return_t exception_raise_state_identity 112 ( 113 mach_port_t exception_port, 114 mach_port_t thread, 115 mach_port_t task, 116 exception_type_t exception, 117 exception_data_t code, 118 mach_msg_type_number_t codeCnt, 119 int *flavor, 120 thread_state_t old_state, 121 mach_msg_type_number_t old_stateCnt, 122 thread_state_t new_state, 123 mach_msg_type_number_t *new_stateCnt 124 ); 125 126 __END_DECLS 127 128 /********************** Caution **************************/ 129 /* The following data types should be used to calculate */ 130 /* maximum message sizes only. The actual message may be */ 131 /* smaller, and the position of the arguments within the */ 132 /* message layout may vary from what is presented here. */ 133 /* For example, if any of the arguments are variable- */ 134 /* sized, and less than the maximum is sent, the data */ 135 /* will be packed tight in the actual message to reduce */ 136 /* the presence of holes. */ 137 /********************** Caution **************************/ 138 139 /* typedefs for all requests */ 140 141 #ifndef __Request__exc_subsystem__defined 142 #define __Request__exc_subsystem__defined 143 144 #ifdef __MigPackStructs 145 #pragma pack(4) 146 #endif 147 typedef struct { 148 mach_msg_header_t Head; 149 /* start of the kernel processed data */ 150 mach_msg_body_t msgh_body; 151 mach_msg_port_descriptor_t thread; 152 mach_msg_port_descriptor_t task; 153 /* end of the kernel processed data */ 154 NDR_record_t NDR; 155 exception_type_t exception; 156 mach_msg_type_number_t codeCnt; 157 integer_t code[2]; 158 } __Request__exception_raise_t; 159 #ifdef __MigPackStructs 160 #pragma pack() 161 #endif 162 163 #ifdef __MigPackStructs 164 #pragma pack(4) 165 #endif 166 typedef struct { 167 mach_msg_header_t Head; 168 NDR_record_t NDR; 169 exception_type_t exception; 170 mach_msg_type_number_t codeCnt; 171 integer_t code[2]; 172 int flavor; 173 mach_msg_type_number_t old_stateCnt; 174 natural_t old_state[224]; 175 } __Request__exception_raise_state_t; 176 #ifdef __MigPackStructs 177 #pragma pack() 178 #endif 179 180 #ifdef __MigPackStructs 181 #pragma pack(4) 182 #endif 183 typedef struct { 184 mach_msg_header_t Head; 185 /* start of the kernel processed data */ 186 mach_msg_body_t msgh_body; 187 mach_msg_port_descriptor_t thread; 188 mach_msg_port_descriptor_t task; 189 /* end of the kernel processed data */ 190 NDR_record_t NDR; 191 exception_type_t exception; 192 mach_msg_type_number_t codeCnt; 193 integer_t code[2]; 194 int flavor; 195 mach_msg_type_number_t old_stateCnt; 196 natural_t old_state[224]; 197 } __Request__exception_raise_state_identity_t; 198 #ifdef __MigPackStructs 199 #pragma pack() 200 #endif 201 #endif /* !__Request__exc_subsystem__defined */ 202 203 /* union of all requests */ 204 205 #ifndef __RequestUnion__exc_subsystem__defined 206 #define __RequestUnion__exc_subsystem__defined 207 union __RequestUnion__exc_subsystem { 208 __Request__exception_raise_t Request_exception_raise; 209 __Request__exception_raise_state_t Request_exception_raise_state; 210 __Request__exception_raise_state_identity_t Request_exception_raise_state_identity; 211 }; 212 #endif /* !__RequestUnion__exc_subsystem__defined */ 213 /* typedefs for all replies */ 214 215 #ifndef __Reply__exc_subsystem__defined 216 #define __Reply__exc_subsystem__defined 217 218 #ifdef __MigPackStructs 219 #pragma pack(4) 220 #endif 221 typedef struct { 222 mach_msg_header_t Head; 223 NDR_record_t NDR; 224 kern_return_t RetCode; 225 } __Reply__exception_raise_t; 226 #ifdef __MigPackStructs 227 #pragma pack() 228 #endif 229 230 #ifdef __MigPackStructs 231 #pragma pack(4) 232 #endif 233 typedef struct { 234 mach_msg_header_t Head; 235 NDR_record_t NDR; 236 kern_return_t RetCode; 237 int flavor; 238 mach_msg_type_number_t new_stateCnt; 239 natural_t new_state[224]; 240 } __Reply__exception_raise_state_t; 241 #ifdef __MigPackStructs 242 #pragma pack() 243 #endif 244 245 #ifdef __MigPackStructs 246 #pragma pack(4) 247 #endif 248 typedef struct { 249 mach_msg_header_t Head; 250 NDR_record_t NDR; 251 kern_return_t RetCode; 252 int flavor; 253 mach_msg_type_number_t new_stateCnt; 254 natural_t new_state[224]; 255 } __Reply__exception_raise_state_identity_t; 256 #ifdef __MigPackStructs 257 #pragma pack() 258 #endif 259 #endif /* !__Reply__exc_subsystem__defined */ 260 261 /* union of all replies */ 262 263 #ifndef __ReplyUnion__exc_subsystem__defined 264 #define __ReplyUnion__exc_subsystem__defined 265 union __ReplyUnion__exc_subsystem { 266 __Reply__exception_raise_t Reply_exception_raise; 267 __Reply__exception_raise_state_t Reply_exception_raise_state; 268 __Reply__exception_raise_state_identity_t Reply_exception_raise_state_identity; 269 }; 270 #endif /* !__RequestUnion__exc_subsystem__defined */ 271 272 #ifndef subsystem_to_name_map_exc 273 #define subsystem_to_name_map_exc \ 274 { "exception_raise", 2401 },\ 275 { "exception_raise_state", 2402 },\ 276 { "exception_raise_state_identity", 2403 } 277 #endif 278 279 #ifdef __AfterMigUserHeader 280 __AfterMigUserHeader 281 #endif /* __AfterMigUserHeader */ 282 283 #endif /* _exc_user_ */