Wed, 31 Dec 2014 07:16:47 +0100
Revert simplistic fix pending revisit of Mozilla integration attempt.
michael@0 | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
michael@0 | 2 | // Use of this source code is governed by a BSD-style license that can be |
michael@0 | 3 | // found in the LICENSE file. |
michael@0 | 4 | |
michael@0 | 5 | /* This file has been imported from |
michael@0 | 6 | * http://git.chromium.org/gitweb/?p=chromium.git;a=blob;f=sandbox/linux/services/android_i386_ucontext.h;hb=99b3e83972e478a42fa72da1ffefee58413e87d4 |
michael@0 | 7 | */ |
michael@0 | 8 | |
michael@0 | 9 | #ifndef SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ |
michael@0 | 10 | #define SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ |
michael@0 | 11 | |
michael@0 | 12 | // We do something compatible with glibc. Hopefully, at some point Android will |
michael@0 | 13 | // provide that for us, and __BIONIC_HAVE_UCONTEXT_T should be defined. |
michael@0 | 14 | // This is mostly copied from breakpad (common/android/include/sys/ucontext.h), |
michael@0 | 15 | // except we do use sigset_t for uc_sigmask instead of a custom type. |
michael@0 | 16 | |
michael@0 | 17 | #if !defined(__BIONIC_HAVE_UCONTEXT_T) |
michael@0 | 18 | #include <asm/sigcontext.h> |
michael@0 | 19 | |
michael@0 | 20 | /* 80-bit floating-point register */ |
michael@0 | 21 | struct _libc_fpreg { |
michael@0 | 22 | unsigned short significand[4]; |
michael@0 | 23 | unsigned short exponent; |
michael@0 | 24 | }; |
michael@0 | 25 | |
michael@0 | 26 | /* Simple floating-point state, see FNSTENV instruction */ |
michael@0 | 27 | struct _libc_fpstate { |
michael@0 | 28 | unsigned long cw; |
michael@0 | 29 | unsigned long sw; |
michael@0 | 30 | unsigned long tag; |
michael@0 | 31 | unsigned long ipoff; |
michael@0 | 32 | unsigned long cssel; |
michael@0 | 33 | unsigned long dataoff; |
michael@0 | 34 | unsigned long datasel; |
michael@0 | 35 | struct _libc_fpreg _st[8]; |
michael@0 | 36 | unsigned long status; |
michael@0 | 37 | }; |
michael@0 | 38 | |
michael@0 | 39 | typedef uint32_t greg_t; |
michael@0 | 40 | |
michael@0 | 41 | typedef struct { |
michael@0 | 42 | uint32_t gregs[19]; |
michael@0 | 43 | struct _libc_fpstate* fpregs; |
michael@0 | 44 | uint32_t oldmask; |
michael@0 | 45 | uint32_t cr2; |
michael@0 | 46 | } mcontext_t; |
michael@0 | 47 | |
michael@0 | 48 | enum { |
michael@0 | 49 | REG_GS = 0, |
michael@0 | 50 | REG_FS, |
michael@0 | 51 | REG_ES, |
michael@0 | 52 | REG_DS, |
michael@0 | 53 | REG_EDI, |
michael@0 | 54 | REG_ESI, |
michael@0 | 55 | REG_EBP, |
michael@0 | 56 | REG_ESP, |
michael@0 | 57 | REG_EBX, |
michael@0 | 58 | REG_EDX, |
michael@0 | 59 | REG_ECX, |
michael@0 | 60 | REG_EAX, |
michael@0 | 61 | REG_TRAPNO, |
michael@0 | 62 | REG_ERR, |
michael@0 | 63 | REG_EIP, |
michael@0 | 64 | REG_CS, |
michael@0 | 65 | REG_EFL, |
michael@0 | 66 | REG_UESP, |
michael@0 | 67 | REG_SS, |
michael@0 | 68 | }; |
michael@0 | 69 | |
michael@0 | 70 | typedef struct ucontext { |
michael@0 | 71 | uint32_t uc_flags; |
michael@0 | 72 | struct ucontext* uc_link; |
michael@0 | 73 | stack_t uc_stack; |
michael@0 | 74 | mcontext_t uc_mcontext; |
michael@0 | 75 | sigset_t uc_sigmask; |
michael@0 | 76 | struct _libc_fpstate __fpregs_mem; |
michael@0 | 77 | } ucontext_t; |
michael@0 | 78 | |
michael@0 | 79 | #else |
michael@0 | 80 | #include <sys/ucontext.h> |
michael@0 | 81 | #endif // __BIONIC_HAVE_UCONTEXT_T |
michael@0 | 82 | |
michael@0 | 83 | #endif // SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ |