| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ | |
| 6 #define SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ | |
| 7 | |
| 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. | |
| 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. | |
| 12 | |
| 13 #if !defined(__BIONIC_HAVE_UCONTEXT_T) | |
| 14 #if !defined(__native_client_nonsfi__) | |
| 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 | |
| 24 | |
| 25 /* 80-bit floating-point register */ | |
| 26 struct _libc_fpreg { | |
| 27 unsigned short significand[4]; | |
| 28 unsigned short exponent; | |
| 29 }; | |
| 30 | |
| 31 /* Simple floating-point state, see FNSTENV instruction */ | |
| 32 struct _libc_fpstate { | |
| 33 unsigned long cw; | |
| 34 unsigned long sw; | |
| 35 unsigned long tag; | |
| 36 unsigned long ipoff; | |
| 37 unsigned long cssel; | |
| 38 unsigned long dataoff; | |
| 39 unsigned long datasel; | |
| 40 struct _libc_fpreg _st[8]; | |
| 41 unsigned long status; | |
| 42 }; | |
| 43 | |
| 44 typedef uint32_t greg_t; | |
| 45 | |
| 46 typedef struct { | |
| 47 uint32_t gregs[19]; | |
| 48 struct _libc_fpstate* fpregs; | |
| 49 uint32_t oldmask; | |
| 50 uint32_t cr2; | |
| 51 } mcontext_t; | |
| 52 | |
| 53 enum { | |
| 54 REG_GS = 0, | |
| 55 REG_FS, | |
| 56 REG_ES, | |
| 57 REG_DS, | |
| 58 REG_EDI, | |
| 59 REG_ESI, | |
| 60 REG_EBP, | |
| 61 REG_ESP, | |
| 62 REG_EBX, | |
| 63 REG_EDX, | |
| 64 REG_ECX, | |
| 65 REG_EAX, | |
| 66 REG_TRAPNO, | |
| 67 REG_ERR, | |
| 68 REG_EIP, | |
| 69 REG_CS, | |
| 70 REG_EFL, | |
| 71 REG_UESP, | |
| 72 REG_SS, | |
| 73 }; | |
| 74 | |
| 75 typedef struct ucontext { | |
| 76 uint32_t uc_flags; | |
| 77 struct ucontext* uc_link; | |
| 78 stack_t uc_stack; | |
| 79 mcontext_t uc_mcontext; | |
| 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 }; | |
| 86 struct _libc_fpstate __fpregs_mem; | |
| 87 } ucontext_t; | |
| 88 | |
| 89 #else | |
| 90 #include <sys/ucontext.h> | |
| 91 #endif // __BIONIC_HAVE_UCONTEXT_T | |
| 92 | |
| 93 #endif // SANDBOX_LINUX_SYSTEM_HEADERS_ANDROID_I386_UCONTEXT_H_ | |
| OLD | NEW |