Bug 1535487 - determine rootUrl directly in buglist creator r=tomprince
[gecko.git] / mfbt / LinuxSignal.h
blob47969ca04220e7dc876d2ef57d2fa6144c327927
1 /* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5 #ifndef mozilla_LinuxSignal_h
6 #define mozilla_LinuxSignal_h
8 namespace mozilla {
10 #if defined(__arm__)
12 // Some (old) Linux kernels on ARM have a bug where a signal handler
13 // can be called without clearing the IT bits in CPSR first. The result
14 // is that the first few instructions of the handler could be skipped,
15 // ultimately resulting in crashes. To workaround this bug, the handler
16 // on ARM is a trampoline that starts with enough NOP instructions, so
17 // that even if the IT bits are not cleared, only the NOP instructions
18 // will be skipped over.
20 template <void (*H)(int, siginfo_t*, void*)>
21 __attribute__((naked)) void SignalTrampoline(int aSignal, siginfo_t* aInfo,
22 void* aContext) {
23 asm volatile("nop; nop; nop; nop" : : : "memory");
25 asm volatile("b %0" : : "X"(H) : "memory");
28 # define MOZ_SIGNAL_TRAMPOLINE(h) (mozilla::SignalTrampoline<h>)
30 #else // __arm__
32 # define MOZ_SIGNAL_TRAMPOLINE(h) (h)
34 #endif // __arm__
36 } // namespace mozilla
38 #endif // mozilla_LinuxSignal_h