Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(171)

Side by Side Diff: runtime/vm/signal_handler.h

Issue 2117593002: Fuchsia: Initial check-in. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comments Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « runtime/vm/pages.cc ('k') | runtime/vm/signal_handler_fuchsia.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 VM_SIGNAL_HANDLER_H_ 5 #ifndef VM_SIGNAL_HANDLER_H_
6 #define VM_SIGNAL_HANDLER_H_ 6 #define 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
(...skipping 16 matching lines...) Expand all
27 #endif // !defined(__BIONIC_HAVE_UCONTEXT_T) 27 #endif // !defined(__BIONIC_HAVE_UCONTEXT_T)
28 #elif defined(TARGET_OS_MACOS) 28 #elif defined(TARGET_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(TARGET_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 }; 36 };
37 #elif defined(TARGET_OS_FUCHSIA)
38 #include <signal.h> // NOLINT
39 #include <ucontext.h> // NOLINT
37 #endif 40 #endif
38 41
39 42
40 // Old linux kernels on ARM might require a trampoline to 43 // Old linux kernels on ARM might require a trampoline to
41 // work around incorrect Thumb -> ARM transitions. See SignalHandlerTrampoline 44 // work around incorrect Thumb -> ARM transitions. See SignalHandlerTrampoline
42 // below for more details. 45 // below for more details.
43 #if defined(HOST_ARCH_ARM) && \ 46 #if defined(HOST_ARCH_ARM) && \
44 (defined(TARGET_OS_LINUX) || defined(TARGET_OS_ANDROID)) && \ 47 (defined(TARGET_OS_LINUX) || defined(TARGET_OS_ANDROID)) && \
45 !defined(__thumb__) 48 !defined(__thumb__)
46 #define USE_SIGNAL_HANDLER_TRAMPOLINE 49 #define USE_SIGNAL_HANDLER_TRAMPOLINE
(...skipping 30 matching lines...) Expand all
77 // 80 //
78 // Kernel does not clear If-Then execution state bits when entering ARM signal 81 // Kernel does not clear If-Then execution state bits when entering ARM signal
79 // handler which violates requirements imposed by ARM architecture reference. 82 // handler which violates requirements imposed by ARM architecture reference.
80 // Some CPUs look at these bits even while in ARM mode which causes them 83 // Some CPUs look at these bits even while in ARM mode which causes them
81 // to skip some instructions in the prologue of the signal handler. 84 // to skip some instructions in the prologue of the signal handler.
82 // 85 //
83 // To work around the issue we insert enough NOPs in the prologue to ensure 86 // To work around the issue we insert enough NOPs in the prologue to ensure
84 // that no actual instructions are skipped and then branch to the actual 87 // that no actual instructions are skipped and then branch to the actual
85 // signal handler. 88 // signal handler.
86 // 89 //
87 // For the kernel patch that fixes the issue see: http://git.kernel.org/cgit/l inux/kernel/git/torvalds/linux.git/commit/?id=6ecf830e5029598732e04067e325d94609 7519cb 90 // For the kernel patch that fixes the issue see:
91 // http://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=6 ecf830e5029598732e04067e325d946097519cb
88 // 92 //
89 // Note: this function is marked "naked" because we must guarantee that 93 // Note: this function is marked "naked" because we must guarantee that
90 // our NOPs occur before any compiler generated prologue. 94 // our NOPs occur before any compiler generated prologue.
91 template <SignalAction action> 95 template <SignalAction action>
92 static __attribute__((naked)) void SignalHandlerTrampoline(int signal, 96 static __attribute__((naked)) void SignalHandlerTrampoline(int signal,
93 siginfo_t* info, 97 siginfo_t* info,
94 void* context_) { 98 void* context_) {
95 // IT (If-Then) instruction makes up to four instructions that follow it 99 // IT (If-Then) instruction makes up to four instructions that follow it
96 // conditional. 100 // conditional.
97 asm volatile("nop; nop; nop; nop" : : : "memory"); 101 asm volatile("nop; nop; nop; nop" : : : "memory");
(...skipping 14 matching lines...) Expand all
112 #endif // defined(USE_SIGNAL_HANDLER_TRAMPOLINE) 116 #endif // defined(USE_SIGNAL_HANDLER_TRAMPOLINE)
113 }; 117 };
114 118
115 119
116 #undef USE_SIGNAL_HANDLER_TRAMPOLINE 120 #undef USE_SIGNAL_HANDLER_TRAMPOLINE
117 121
118 122
119 } // namespace dart 123 } // namespace dart
120 124
121 #endif // VM_SIGNAL_HANDLER_H_ 125 #endif // VM_SIGNAL_HANDLER_H_
OLDNEW
« no previous file with comments | « runtime/vm/pages.cc ('k') | runtime/vm/signal_handler_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698