toolkit/crashreporter/google-breakpad/src/common/android/include/sys/user.h

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/toolkit/crashreporter/google-breakpad/src/common/android/include/sys/user.h	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,134 @@
     1.4 +// Copyright (c) 2012, Google Inc.
     1.5 +// All rights reserved.
     1.6 +//
     1.7 +// Redistribution and use in source and binary forms, with or without
     1.8 +// modification, are permitted provided that the following conditions are
     1.9 +// met:
    1.10 +//
    1.11 +//     * Redistributions of source code must retain the above copyright
    1.12 +// notice, this list of conditions and the following disclaimer.
    1.13 +//     * Redistributions in binary form must reproduce the above
    1.14 +// copyright notice, this list of conditions and the following disclaimer
    1.15 +// in the documentation and/or other materials provided with the
    1.16 +// distribution.
    1.17 +//     * Neither the name of Google Inc. nor the names of its
    1.18 +// contributors may be used to endorse or promote products derived from
    1.19 +// this software without specific prior written permission.
    1.20 +//
    1.21 +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
    1.22 +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
    1.23 +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
    1.24 +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
    1.25 +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    1.26 +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
    1.27 +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
    1.28 +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
    1.29 +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    1.30 +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
    1.31 +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
    1.32 +
    1.33 +#ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
    1.34 +#define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
    1.35 +
    1.36 +#ifdef __cplusplus
    1.37 +extern "C" {
    1.38 +#endif  // __cplusplus
    1.39 +
    1.40 +// These types are used with ptrace(), more specifically with
    1.41 +// PTRACE_GETREGS, PTRACE_GETFPREGS and PTRACE_GETVFPREGS respectively.
    1.42 +//
    1.43 +// They are also defined, sometimes with different names, in <asm/user.h>
    1.44 +//
    1.45 +
    1.46 +#if defined(__arm__)
    1.47 +
    1.48 +#define _ARM_USER_H  1  // Prevent <asm/user.h> conflicts
    1.49 +
    1.50 +// Note: on ARM, GLibc uses user_regs instead of user_regs_struct.
    1.51 +struct user_regs {
    1.52 +  // Note: Entries 0-15 match r0..r15
    1.53 +  //       Entry 16 is used to store the CPSR register.
    1.54 +  //       Entry 17 is used to store the "orig_r0" value.
    1.55 +  unsigned long int uregs[18];
    1.56 +};
    1.57 +
    1.58 +// Same here: user_fpregs instead of user_fpregs_struct.
    1.59 +struct user_fpregs {
    1.60 +  struct fp_reg {
    1.61 +    unsigned int sign1:1;
    1.62 +    unsigned int unused:15;
    1.63 +    unsigned int sign2:1;
    1.64 +    unsigned int exponent:14;
    1.65 +    unsigned int j:1;
    1.66 +    unsigned int mantissa1:31;
    1.67 +    unsigned int mantissa0:32;
    1.68 +  } fpregs[8];
    1.69 +  unsigned int  fpsr:32;
    1.70 +  unsigned int  fpcr:32;
    1.71 +  unsigned char ftype[8];
    1.72 +  unsigned int  init_flag;
    1.73 +};
    1.74 +
    1.75 +// GLibc doesn't define this one in <sys/user.h> though.
    1.76 +struct user_vfpregs {
    1.77 +  unsigned long long  fpregs[32];
    1.78 +  unsigned long       fpscr;
    1.79 +};
    1.80 +
    1.81 +#elif defined(__i386__)
    1.82 +
    1.83 +#define _I386_USER_H 1  // Prevent <asm/user.h> conflicts
    1.84 +
    1.85 +// GLibc-compatible definitions
    1.86 +struct user_regs_struct {
    1.87 +  long ebx, ecx, edx, esi, edi, ebp, eax;
    1.88 +  long xds, xes, xfs, xgs, orig_eax;
    1.89 +  long eip, xcs, eflags, esp, xss;
    1.90 +};
    1.91 +
    1.92 +struct user_fpregs_struct {
    1.93 +  long cwd, swd, twd, fip, fcs, foo, fos;
    1.94 +  long st_space[20];
    1.95 +};
    1.96 +
    1.97 +struct user_fpxregs_struct {
    1.98 +  unsigned short cwd, swd, twd, fop;
    1.99 +  long fip, fcs, foo, fos, mxcsr, reserved;
   1.100 +  long st_space[32];
   1.101 +  long xmm_space[32];
   1.102 +  long padding[56];
   1.103 +};
   1.104 +
   1.105 +struct user {
   1.106 +  struct user_regs_struct    regs;
   1.107 +  int                        u_fpvalid;
   1.108 +  struct user_fpregs_struct  i387;
   1.109 +  unsigned long              u_tsize;
   1.110 +  unsigned long              u_dsize;
   1.111 +  unsigned long              u_ssize;
   1.112 +  unsigned long              start_code;
   1.113 +  unsigned long              start_stack;
   1.114 +  long                       signal;
   1.115 +  int                        reserved;
   1.116 +  struct user_regs_struct*   u_ar0;
   1.117 +  struct user_fpregs_struct* u_fpstate;
   1.118 +  unsigned long              magic;
   1.119 +  char                       u_comm [32];
   1.120 +  int                        u_debugreg [8];
   1.121 +};
   1.122 +
   1.123 +
   1.124 +#elif defined(__mips__)
   1.125 +
   1.126 +// TODO: Provide some useful definitions here, once the rest of Breakpad
   1.127 +//        requires them.
   1.128 +
   1.129 +#else
   1.130 +#  error "Unsupported Android CPU ABI"
   1.131 +#endif
   1.132 +
   1.133 +#ifdef __cplusplus
   1.134 +}  // extern "C"
   1.135 +#endif  // __cplusplus
   1.136 +
   1.137 +#endif  // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H

mercurial