OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ | 5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ |
6 #define SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ | 6 #define SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ |
7 | 7 |
8 // We do something compatible with glibc. Hopefully, at some point Android will | 8 // We do something compatible with glibc. Hopefully, at some point Android will |
9 // provide that for us, and __BIONIC_HAVE_UCONTEXT_T should be defined. | 9 // provide that for us, and __BIONIC_HAVE_UCONTEXT_T should be defined. |
10 // This is mostly copied from breakpad (common/android/include/sys/ucontext.h), | 10 // This is mostly copied from breakpad (common/android/include/sys/ucontext.h), |
11 // except we do use sigset_t for uc_sigmask instead of a custom type. | 11 // except we do use sigset_t for uc_sigmask instead of a custom type. |
12 | 12 |
13 #if !defined(__BIONIC_HAVE_UCONTEXT_T) | 13 #if !defined(__BIONIC_HAVE_UCONTEXT_T) |
| 14 #if !defined(__native_client_nonsfi__) |
14 #include <asm/sigcontext.h> | 15 #include <asm/sigcontext.h> |
| 16 #else |
| 17 // In PNaCl toolchain, sigcontext is not defined. So here declare it. |
| 18 typedef struct sigaltstack { |
| 19 void* ss_sp; |
| 20 int ss_flags; |
| 21 size_t ss_size; |
| 22 } stack_t; |
| 23 #endif |
15 | 24 |
16 /* 80-bit floating-point register */ | 25 /* 80-bit floating-point register */ |
17 struct _libc_fpreg { | 26 struct _libc_fpreg { |
18 unsigned short significand[4]; | 27 unsigned short significand[4]; |
19 unsigned short exponent; | 28 unsigned short exponent; |
20 }; | 29 }; |
21 | 30 |
22 /* Simple floating-point state, see FNSTENV instruction */ | 31 /* Simple floating-point state, see FNSTENV instruction */ |
23 struct _libc_fpstate { | 32 struct _libc_fpstate { |
24 unsigned long cw; | 33 unsigned long cw; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 REG_EFL, | 70 REG_EFL, |
62 REG_UESP, | 71 REG_UESP, |
63 REG_SS, | 72 REG_SS, |
64 }; | 73 }; |
65 | 74 |
66 typedef struct ucontext { | 75 typedef struct ucontext { |
67 uint32_t uc_flags; | 76 uint32_t uc_flags; |
68 struct ucontext* uc_link; | 77 struct ucontext* uc_link; |
69 stack_t uc_stack; | 78 stack_t uc_stack; |
70 mcontext_t uc_mcontext; | 79 mcontext_t uc_mcontext; |
71 sigset_t uc_sigmask; | 80 // Android and PNaCl toolchain's sigset_t has only 32 bits, though Linux |
| 81 // ABI requires 64 bits. |
| 82 union { |
| 83 sigset_t uc_sigmask; |
| 84 uint32_t kernel_sigmask[2]; |
| 85 }; |
72 struct _libc_fpstate __fpregs_mem; | 86 struct _libc_fpstate __fpregs_mem; |
73 } ucontext_t; | 87 } ucontext_t; |
74 | 88 |
75 #else | 89 #else |
76 #include <sys/ucontext.h> | 90 #include <sys/ucontext.h> |
77 #endif // __BIONIC_HAVE_UCONTEXT_T | 91 #endif // __BIONIC_HAVE_UCONTEXT_T |
78 | 92 |
79 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ | 93 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ |
OLD | NEW |