michael@0: // Copyright (c) 2012 The Chromium Authors. All rights reserved. michael@0: // Use of this source code is governed by a BSD-style license that can be michael@0: // found in the LICENSE file. michael@0: michael@0: /* This file has been imported from michael@0: * http://git.chromium.org/gitweb/?p=chromium.git;a=blob;f=sandbox/linux/services/android_i386_ucontext.h;hb=99b3e83972e478a42fa72da1ffefee58413e87d4 michael@0: */ michael@0: michael@0: #ifndef SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ michael@0: #define SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_ michael@0: michael@0: // We do something compatible with glibc. Hopefully, at some point Android will michael@0: // provide that for us, and __BIONIC_HAVE_UCONTEXT_T should be defined. michael@0: // This is mostly copied from breakpad (common/android/include/sys/ucontext.h), michael@0: // except we do use sigset_t for uc_sigmask instead of a custom type. michael@0: michael@0: #if !defined(__BIONIC_HAVE_UCONTEXT_T) michael@0: #include michael@0: michael@0: /* 80-bit floating-point register */ michael@0: struct _libc_fpreg { michael@0: unsigned short significand[4]; michael@0: unsigned short exponent; michael@0: }; michael@0: michael@0: /* Simple floating-point state, see FNSTENV instruction */ michael@0: struct _libc_fpstate { michael@0: unsigned long cw; michael@0: unsigned long sw; michael@0: unsigned long tag; michael@0: unsigned long ipoff; michael@0: unsigned long cssel; michael@0: unsigned long dataoff; michael@0: unsigned long datasel; michael@0: struct _libc_fpreg _st[8]; michael@0: unsigned long status; michael@0: }; michael@0: michael@0: typedef uint32_t greg_t; michael@0: michael@0: typedef struct { michael@0: uint32_t gregs[19]; michael@0: struct _libc_fpstate* fpregs; michael@0: uint32_t oldmask; michael@0: uint32_t cr2; michael@0: } mcontext_t; michael@0: michael@0: enum { michael@0: REG_GS = 0, michael@0: REG_FS, michael@0: REG_ES, michael@0: REG_DS, michael@0: REG_EDI, michael@0: REG_ESI, michael@0: REG_EBP, michael@0: REG_ESP, michael@0: REG_EBX, michael@0: REG_EDX, michael@0: REG_ECX, michael@0: REG_EAX, michael@0: REG_TRAPNO, michael@0: REG_ERR, michael@0: REG_EIP, michael@0: REG_CS, michael@0: REG_EFL, michael@0: REG_UESP, michael@0: REG_SS, michael@0: }; michael@0: michael@0: typedef struct ucontext { michael@0: uint32_t uc_flags; michael@0: struct ucontext* uc_link; michael@0: stack_t uc_stack; michael@0: mcontext_t uc_mcontext; michael@0: sigset_t uc_sigmask; michael@0: struct _libc_fpstate __fpregs_mem; michael@0: } ucontext_t; michael@0: michael@0: #else michael@0: #include michael@0: #endif // __BIONIC_HAVE_UCONTEXT_T michael@0: michael@0: #endif // SANDBOX_LINUX_SERVICES_ANDROID_I386_UCONTEXT_H_