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