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

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // Copyright (c) 2012, Google Inc.
michael@0 2 // All rights reserved.
michael@0 3 //
michael@0 4 // Redistribution and use in source and binary forms, with or without
michael@0 5 // modification, are permitted provided that the following conditions are
michael@0 6 // met:
michael@0 7 //
michael@0 8 // * Redistributions of source code must retain the above copyright
michael@0 9 // notice, this list of conditions and the following disclaimer.
michael@0 10 // * Redistributions in binary form must reproduce the above
michael@0 11 // copyright notice, this list of conditions and the following disclaimer
michael@0 12 // in the documentation and/or other materials provided with the
michael@0 13 // distribution.
michael@0 14 // * Neither the name of Google Inc. nor the names of its
michael@0 15 // contributors may be used to endorse or promote products derived from
michael@0 16 // this software without specific prior written permission.
michael@0 17 //
michael@0 18 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
michael@0 19 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
michael@0 20 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
michael@0 21 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
michael@0 22 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
michael@0 23 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
michael@0 24 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
michael@0 25 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
michael@0 26 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
michael@0 27 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
michael@0 28 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
michael@0 29
michael@0 30 #ifndef GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
michael@0 31 #define GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H
michael@0 32
michael@0 33 #ifdef __cplusplus
michael@0 34 extern "C" {
michael@0 35 #endif // __cplusplus
michael@0 36
michael@0 37 // These types are used with ptrace(), more specifically with
michael@0 38 // PTRACE_GETREGS, PTRACE_GETFPREGS and PTRACE_GETVFPREGS respectively.
michael@0 39 //
michael@0 40 // They are also defined, sometimes with different names, in <asm/user.h>
michael@0 41 //
michael@0 42
michael@0 43 #if defined(__arm__)
michael@0 44
michael@0 45 #define _ARM_USER_H 1 // Prevent <asm/user.h> conflicts
michael@0 46
michael@0 47 // Note: on ARM, GLibc uses user_regs instead of user_regs_struct.
michael@0 48 struct user_regs {
michael@0 49 // Note: Entries 0-15 match r0..r15
michael@0 50 // Entry 16 is used to store the CPSR register.
michael@0 51 // Entry 17 is used to store the "orig_r0" value.
michael@0 52 unsigned long int uregs[18];
michael@0 53 };
michael@0 54
michael@0 55 // Same here: user_fpregs instead of user_fpregs_struct.
michael@0 56 struct user_fpregs {
michael@0 57 struct fp_reg {
michael@0 58 unsigned int sign1:1;
michael@0 59 unsigned int unused:15;
michael@0 60 unsigned int sign2:1;
michael@0 61 unsigned int exponent:14;
michael@0 62 unsigned int j:1;
michael@0 63 unsigned int mantissa1:31;
michael@0 64 unsigned int mantissa0:32;
michael@0 65 } fpregs[8];
michael@0 66 unsigned int fpsr:32;
michael@0 67 unsigned int fpcr:32;
michael@0 68 unsigned char ftype[8];
michael@0 69 unsigned int init_flag;
michael@0 70 };
michael@0 71
michael@0 72 // GLibc doesn't define this one in <sys/user.h> though.
michael@0 73 struct user_vfpregs {
michael@0 74 unsigned long long fpregs[32];
michael@0 75 unsigned long fpscr;
michael@0 76 };
michael@0 77
michael@0 78 #elif defined(__i386__)
michael@0 79
michael@0 80 #define _I386_USER_H 1 // Prevent <asm/user.h> conflicts
michael@0 81
michael@0 82 // GLibc-compatible definitions
michael@0 83 struct user_regs_struct {
michael@0 84 long ebx, ecx, edx, esi, edi, ebp, eax;
michael@0 85 long xds, xes, xfs, xgs, orig_eax;
michael@0 86 long eip, xcs, eflags, esp, xss;
michael@0 87 };
michael@0 88
michael@0 89 struct user_fpregs_struct {
michael@0 90 long cwd, swd, twd, fip, fcs, foo, fos;
michael@0 91 long st_space[20];
michael@0 92 };
michael@0 93
michael@0 94 struct user_fpxregs_struct {
michael@0 95 unsigned short cwd, swd, twd, fop;
michael@0 96 long fip, fcs, foo, fos, mxcsr, reserved;
michael@0 97 long st_space[32];
michael@0 98 long xmm_space[32];
michael@0 99 long padding[56];
michael@0 100 };
michael@0 101
michael@0 102 struct user {
michael@0 103 struct user_regs_struct regs;
michael@0 104 int u_fpvalid;
michael@0 105 struct user_fpregs_struct i387;
michael@0 106 unsigned long u_tsize;
michael@0 107 unsigned long u_dsize;
michael@0 108 unsigned long u_ssize;
michael@0 109 unsigned long start_code;
michael@0 110 unsigned long start_stack;
michael@0 111 long signal;
michael@0 112 int reserved;
michael@0 113 struct user_regs_struct* u_ar0;
michael@0 114 struct user_fpregs_struct* u_fpstate;
michael@0 115 unsigned long magic;
michael@0 116 char u_comm [32];
michael@0 117 int u_debugreg [8];
michael@0 118 };
michael@0 119
michael@0 120
michael@0 121 #elif defined(__mips__)
michael@0 122
michael@0 123 // TODO: Provide some useful definitions here, once the rest of Breakpad
michael@0 124 // requires them.
michael@0 125
michael@0 126 #else
michael@0 127 # error "Unsupported Android CPU ABI"
michael@0 128 #endif
michael@0 129
michael@0 130 #ifdef __cplusplus
michael@0 131 } // extern "C"
michael@0 132 #endif // __cplusplus
michael@0 133
michael@0 134 #endif // GOOGLE_BREAKPAD_COMMON_ANDROID_INCLUDE_SYS_USER_H

mercurial