1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/security/sandbox/linux/android_i386_ucontext.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,83 @@ 1.4 +// Copyright (c) 2012 The Chromium Authors. All rights reserved. 1.5 +// Use of this source code is governed by a BSD-style license that can be 1.6 +// found in the LICENSE file. 1.7 + 1.8 +/* This file has been imported from 1.9 + * http://git.chromium.org/gitweb/?p=chromium.git;a=blob;f=sandbox/linux/services/android_i386_ucontext.h;hb=99b3e83972e478a42fa72da1ffefee58413e87d4 1.10 + */ 1.11 + 1.12 +#ifndef SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ 1.13 +#define SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ 1.14 + 1.15 +// We do something compatible with glibc. Hopefully, at some point Android will 1.16 +// provide that for us, and __BIONIC_HAVE_UCONTEXT_T should be defined. 1.17 +// This is mostly copied from breakpad (common/android/include/sys/ucontext.h), 1.18 +// except we do use sigset_t for uc_sigmask instead of a custom type. 1.19 + 1.20 +#if !defined(__BIONIC_HAVE_UCONTEXT_T) 1.21 +#include <asm/sigcontext.h> 1.22 + 1.23 +/* 80-bit floating-point register */ 1.24 +struct _libc_fpreg { 1.25 + unsigned short significand[4]; 1.26 + unsigned short exponent; 1.27 +}; 1.28 + 1.29 +/* Simple floating-point state, see FNSTENV instruction */ 1.30 +struct _libc_fpstate { 1.31 + unsigned long cw; 1.32 + unsigned long sw; 1.33 + unsigned long tag; 1.34 + unsigned long ipoff; 1.35 + unsigned long cssel; 1.36 + unsigned long dataoff; 1.37 + unsigned long datasel; 1.38 + struct _libc_fpreg _st[8]; 1.39 + unsigned long status; 1.40 +}; 1.41 + 1.42 +typedef uint32_t greg_t; 1.43 + 1.44 +typedef struct { 1.45 + uint32_t gregs[19]; 1.46 + struct _libc_fpstate* fpregs; 1.47 + uint32_t oldmask; 1.48 + uint32_t cr2; 1.49 +} mcontext_t; 1.50 + 1.51 +enum { 1.52 + REG_GS = 0, 1.53 + REG_FS, 1.54 + REG_ES, 1.55 + REG_DS, 1.56 + REG_EDI, 1.57 + REG_ESI, 1.58 + REG_EBP, 1.59 + REG_ESP, 1.60 + REG_EBX, 1.61 + REG_EDX, 1.62 + REG_ECX, 1.63 + REG_EAX, 1.64 + REG_TRAPNO, 1.65 + REG_ERR, 1.66 + REG_EIP, 1.67 + REG_CS, 1.68 + REG_EFL, 1.69 + REG_UESP, 1.70 + REG_SS, 1.71 +}; 1.72 + 1.73 +typedef struct ucontext { 1.74 + uint32_t uc_flags; 1.75 + struct ucontext* uc_link; 1.76 + stack_t uc_stack; 1.77 + mcontext_t uc_mcontext; 1.78 + sigset_t uc_sigmask; 1.79 + struct _libc_fpstate __fpregs_mem; 1.80 +} ucontext_t; 1.81 + 1.82 +#else 1.83 +#include <sys/ucontext.h> 1.84 +#endif // __BIONIC_HAVE_UCONTEXT_T 1.85 + 1.86 +#endif // SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_