OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright (c) 2015 The Native Client Authors. All rights reserved. |
| 3 * Use of this source code is governed by a BSD-style license that can be |
| 4 * found in the LICENSE file. |
| 5 */ |
| 6 |
| 7 #ifndef NATIVE_CLIENT_SRC_NONSFI_LINUX_IRT_SIGNAL_HANDLING_H_ |
| 8 #define NATIVE_CLIENT_SRC_NONSFI_LINUX_IRT_SIGNAL_HANDLING_H_ 1 |
| 9 |
| 10 #include <pthread.h> |
| 11 |
| 12 #include "native_client/src/include/nacl/nacl_exception.h" |
| 13 |
| 14 EXTERN_C_BEGIN |
| 15 |
| 16 #if defined(__i386__) |
| 17 |
| 18 /* From linux/arch/x86/include/uapi/asm/sigcontext32.h */ |
| 19 struct sigcontext_ia32 { |
| 20 unsigned short gs, __gsh; |
| 21 unsigned short fs, __fsh; |
| 22 unsigned short es, __esh; |
| 23 unsigned short ds, __dsh; |
| 24 unsigned int di; |
| 25 unsigned int si; |
| 26 unsigned int bp; |
| 27 unsigned int sp; |
| 28 unsigned int bx; |
| 29 unsigned int dx; |
| 30 unsigned int cx; |
| 31 unsigned int ax; |
| 32 unsigned int trapno; |
| 33 unsigned int err; |
| 34 unsigned int ip; |
| 35 unsigned short cs, __csh; |
| 36 unsigned int flags; |
| 37 unsigned int sp_at_signal; |
| 38 unsigned short ss, __ssh; |
| 39 unsigned int fpstate; |
| 40 unsigned int oldmask; |
| 41 unsigned int cr2; |
| 42 }; |
| 43 |
| 44 typedef struct sigcontext_ia32 linux_mcontext_t; |
| 45 |
| 46 #elif defined(__arm__) |
| 47 |
| 48 /* From linux/arch/arm/include/uapi/asm/sigcontext.h */ |
| 49 struct sigcontext_arm { |
| 50 uint32_t trap_no; |
| 51 uint32_t error_code; |
| 52 uint32_t oldmask; |
| 53 uint32_t arm_r0; |
| 54 uint32_t arm_r1; |
| 55 uint32_t arm_r2; |
| 56 uint32_t arm_r3; |
| 57 uint32_t arm_r4; |
| 58 uint32_t arm_r5; |
| 59 uint32_t arm_r6; |
| 60 uint32_t arm_r7; |
| 61 uint32_t arm_r8; |
| 62 uint32_t arm_r9; |
| 63 uint32_t arm_r10; |
| 64 uint32_t arm_r11; /* fp */ |
| 65 uint32_t arm_r12; /* ip */ |
| 66 uint32_t arm_sp; |
| 67 uint32_t arm_lr; |
| 68 uint32_t arm_pc; |
| 69 uint32_t arm_cpsr; |
| 70 uint32_t fault_address; |
| 71 }; |
| 72 |
| 73 typedef struct sigcontext_arm linux_mcontext_t; |
| 74 |
| 75 #else |
| 76 #error "unsupported architecture" |
| 77 #endif |
| 78 |
| 79 struct NonSfiExceptionFrame { |
| 80 struct NaClExceptionContext context; |
| 81 struct NaClExceptionPortableContext portable; |
| 82 }; |
| 83 |
| 84 extern pthread_mutex_t g_signal_handler_mutex; |
| 85 void nonsfi_initialize_signal_handler_locked(void); |
| 86 void nonsfi_install_exception_handler_locked(void); |
| 87 void exception_frame_from_signal_context( |
| 88 struct NonSfiExceptionFrame *frame, |
| 89 const void *raw_ctx); |
| 90 |
| 91 EXTERN_C_END |
| 92 |
| 93 #endif |
OLD | NEW |