| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RUNTIME_VM_SIGNAL_HANDLER_H_ | 5 #ifndef RUNTIME_VM_SIGNAL_HANDLER_H_ |
| 6 #define RUNTIME_VM_SIGNAL_HANDLER_H_ | 6 #define RUNTIME_VM_SIGNAL_HANDLER_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 #include "vm/globals.h" | 9 #include "vm/globals.h" |
| 10 | 10 |
| 11 #if defined(TARGET_OS_LINUX) | 11 #if defined(HOST_OS_LINUX) |
| 12 #include <signal.h> // NOLINT | 12 #include <signal.h> // NOLINT |
| 13 #include <ucontext.h> // NOLINT | 13 #include <ucontext.h> // NOLINT |
| 14 #elif defined(TARGET_OS_ANDROID) | 14 #elif defined(HOST_OS_ANDROID) |
| 15 #include <signal.h> // NOLINT | 15 #include <signal.h> // NOLINT |
| 16 #if !defined(__BIONIC_HAVE_UCONTEXT_T) | 16 #if !defined(__BIONIC_HAVE_UCONTEXT_T) |
| 17 #include <asm/sigcontext.h> // NOLINT | 17 #include <asm/sigcontext.h> // NOLINT |
| 18 // If ucontext_t is not defined on Android, define it here. | 18 // If ucontext_t is not defined on Android, define it here. |
| 19 typedef struct sigcontext mcontext_t; | 19 typedef struct sigcontext mcontext_t; |
| 20 typedef struct ucontext { | 20 typedef struct ucontext { |
| 21 uint32_t uc_flags; | 21 uint32_t uc_flags; |
| 22 struct ucontext* uc_link; | 22 struct ucontext* uc_link; |
| 23 stack_t uc_stack; | 23 stack_t uc_stack; |
| 24 struct sigcontext uc_mcontext; | 24 struct sigcontext uc_mcontext; |
| 25 uint32_t uc_sigmask; | 25 uint32_t uc_sigmask; |
| 26 } ucontext_t; | 26 } ucontext_t; |
| 27 #endif // !defined(__BIONIC_HAVE_UCONTEXT_T) | 27 #endif // !defined(__BIONIC_HAVE_UCONTEXT_T) |
| 28 #elif defined(TARGET_OS_MACOS) | 28 #elif defined(HOST_OS_MACOS) |
| 29 #include <signal.h> // NOLINT | 29 #include <signal.h> // NOLINT |
| 30 #include <sys/ucontext.h> // NOLINT | 30 #include <sys/ucontext.h> // NOLINT |
| 31 #elif defined(TARGET_OS_WINDOWS) | 31 #elif defined(HOST_OS_WINDOWS) |
| 32 // Stub out for windows. | 32 // Stub out for windows. |
| 33 struct siginfo_t; | 33 struct siginfo_t; |
| 34 struct mcontext_t; | 34 struct mcontext_t; |
| 35 struct sigset_t {}; | 35 struct sigset_t {}; |
| 36 #elif defined(TARGET_OS_FUCHSIA) | 36 #elif defined(HOST_OS_FUCHSIA) |
| 37 #include <signal.h> // NOLINT | 37 #include <signal.h> // NOLINT |
| 38 #include <ucontext.h> // NOLINT | 38 #include <ucontext.h> // NOLINT |
| 39 #endif | 39 #endif |
| 40 | 40 |
| 41 | 41 |
| 42 // Old linux kernels on ARM might require a trampoline to | 42 // Old linux kernels on ARM might require a trampoline to |
| 43 // work around incorrect Thumb -> ARM transitions. See SignalHandlerTrampoline | 43 // work around incorrect Thumb -> ARM transitions. See SignalHandlerTrampoline |
| 44 // below for more details. | 44 // below for more details. |
| 45 #if defined(HOST_ARCH_ARM) && \ | 45 #if defined(HOST_ARCH_ARM) && \ |
| 46 (defined(TARGET_OS_LINUX) || defined(TARGET_OS_ANDROID)) && \ | 46 (defined(HOST_OS_LINUX) || defined(HOST_OS_ANDROID)) && \ |
| 47 !defined(__thumb__) | 47 !defined(__thumb__) |
| 48 #define USE_SIGNAL_HANDLER_TRAMPOLINE | 48 #define USE_SIGNAL_HANDLER_TRAMPOLINE |
| 49 #endif | 49 #endif |
| 50 | 50 |
| 51 | 51 |
| 52 namespace dart { | 52 namespace dart { |
| 53 | 53 |
| 54 typedef void (*SignalAction)(int signal, siginfo_t* info, void* context); | 54 typedef void (*SignalAction)(int signal, siginfo_t* info, void* context); |
| 55 | 55 |
| 56 class SignalHandler : public AllStatic { | 56 class SignalHandler : public AllStatic { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 #endif // defined(USE_SIGNAL_HANDLER_TRAMPOLINE) | 113 #endif // defined(USE_SIGNAL_HANDLER_TRAMPOLINE) |
| 114 }; | 114 }; |
| 115 | 115 |
| 116 | 116 |
| 117 #undef USE_SIGNAL_HANDLER_TRAMPOLINE | 117 #undef USE_SIGNAL_HANDLER_TRAMPOLINE |
| 118 | 118 |
| 119 | 119 |
| 120 } // namespace dart | 120 } // namespace dart |
| 121 | 121 |
| 122 #endif // RUNTIME_VM_SIGNAL_HANDLER_H_ | 122 #endif // RUNTIME_VM_SIGNAL_HANDLER_H_ |
| OLD | NEW |