- add sources.
[platform/framework/web/crosswalk.git] / src / sandbox / linux / services / android_i386_ucontext.h
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_SERVICES_ANDROID_I386_UCONTEXT_H_
6 #define SANDBOX_LINUX_SERVICES_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 #include <asm/sigcontext.h>
15
16 /* 80-bit floating-point register */
17 struct _libc_fpreg {
18   unsigned short significand[4];
19   unsigned short exponent;
20 };
21
22 /* Simple floating-point state, see FNSTENV instruction */
23 struct _libc_fpstate {
24   unsigned long cw;
25   unsigned long sw;
26   unsigned long tag;
27   unsigned long ipoff;
28   unsigned long cssel;
29   unsigned long dataoff;
30   unsigned long datasel;
31   struct _libc_fpreg _st[8];
32   unsigned long status;
33 };
34
35 typedef uint32_t greg_t;
36
37 typedef struct {
38   uint32_t gregs[19];
39   struct _libc_fpstate* fpregs;
40   uint32_t oldmask;
41   uint32_t cr2;
42 } mcontext_t;
43
44 enum {
45   REG_GS = 0,
46   REG_FS,
47   REG_ES,
48   REG_DS,
49   REG_EDI,
50   REG_ESI,
51   REG_EBP,
52   REG_ESP,
53   REG_EBX,
54   REG_EDX,
55   REG_ECX,
56   REG_EAX,
57   REG_TRAPNO,
58   REG_ERR,
59   REG_EIP,
60   REG_CS,
61   REG_EFL,
62   REG_UESP,
63   REG_SS,
64 };
65
66 typedef struct ucontext {
67   uint32_t uc_flags;
68   struct ucontext* uc_link;
69   stack_t uc_stack;
70   mcontext_t uc_mcontext;
71   sigset_t uc_sigmask;
72   struct _libc_fpstate __fpregs_mem;
73 } ucontext_t;
74
75 #else
76 #include <sys/ucontext.h>
77 #endif  // __BIONIC_HAVE_UCONTEXT_T
78
79 #endif  // SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_