2 * Copyright (C) 2014 The Android Open Source Project
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 #ifndef _SYS_UCONTEXT_H_
30 #define _SYS_UCONTEXT_H_
58 #define NGREG 18 /* Like glibc. */
61 typedef greg_t gregset_t
[NGREG
];
63 #include <asm/sigcontext.h>
64 typedef struct sigcontext mcontext_t
;
66 typedef struct ucontext
{
67 unsigned long uc_flags
;
68 struct ucontext
* uc_link
;
70 mcontext_t uc_mcontext
;
72 // Android has a wrong (smaller) sigset_t on ARM.
73 uint32_t __padding_rt_sigset
;
74 // The kernel adds extra padding after uc_sigmask to match glibc sigset_t on ARM.
76 unsigned long uc_regspace
[128] __attribute__((__aligned__(8)));
79 #elif defined(__aarch64__)
81 #include <asm/sigcontext.h>
82 typedef struct sigcontext mcontext_t
;
84 typedef struct ucontext
{
85 unsigned long uc_flags
;
86 struct ucontext
*uc_link
;
89 // The kernel adds extra padding after uc_sigmask to match glibc sigset_t on ARM64.
90 char __padding
[128 - sizeof(sigset_t
)];
91 mcontext_t uc_mcontext
;
94 #elif defined(__i386__)
120 typedef greg_t gregset_t
[NGREG
];
123 unsigned short significand
[4];
124 unsigned short exponent
;
127 struct _libc_fpstate
{
133 unsigned long dataoff
;
134 unsigned long datasel
;
135 struct _libc_fpreg _st
[8];
136 unsigned long status
;
139 typedef struct _libc_fpstate
* fpregset_t
;
144 unsigned long oldmask
;
148 typedef struct ucontext
{
149 unsigned long uc_flags
;
150 struct ucontext
* uc_link
;
152 mcontext_t uc_mcontext
;
154 // Android has a wrong (smaller) sigset_t on x86.
155 uint32_t __padding_rt_sigset
;
156 struct _libc_fpstate __fpregs_mem
;
159 #elif defined(__mips__)
161 /* glibc doesn't have names for MIPS registers. */
166 typedef unsigned long long greg_t
;
167 typedef greg_t gregset_t
[NGREG
];
169 typedef struct fpregset
{
171 double fp_dregs
[NFPREG
];
200 typedef struct ucontext
{
201 unsigned long uc_flags
;
202 struct ucontext
* uc_link
;
204 mcontext_t uc_mcontext
;
208 #elif defined(__mips64__)
212 #elif defined(__x86_64__)
242 typedef greg_t gregset_t
[NGREG
];
244 struct _libc_fpxreg
{
245 unsigned short significand
[4];
246 unsigned short exponent
;
247 unsigned short padding
[3];
250 struct _libc_xmmreg
{
254 struct _libc_fpstate
{
263 struct _libc_fpxreg _st
[8];
264 struct _libc_xmmreg _xmm
[16];
265 uint32_t padding
[24];
268 typedef struct _libc_fpstate
* fpregset_t
;
273 unsigned long __reserved1
[8];
276 typedef struct ucontext
{
277 unsigned long uc_flags
;
278 struct ucontext
* uc_link
;
280 mcontext_t uc_mcontext
;
282 struct _libc_fpstate __fpregs_mem
;
289 #endif /* _SYS_UCONTEXT_H_ */