| 1 | /* Copyright (C) 2001-2014 Free Software Foundation, Inc. | 
| 2 |    This file is part of the GNU C Library. | 
| 3 |  | 
| 4 |    The GNU C Library is free software; you can redistribute it and/or | 
| 5 |    modify it under the terms of the GNU Lesser General Public | 
| 6 |    License as published by the Free Software Foundation; either | 
| 7 |    version 2.1 of the License, or (at your option) any later version. | 
| 8 |  | 
| 9 |    The GNU C Library is distributed in the hope that it will be useful, | 
| 10 |    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 11 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU | 
| 12 |    Lesser General Public License for more details. | 
| 13 |  | 
| 14 |    You should have received a copy of the GNU Lesser General Public | 
| 15 |    License along with the GNU C Library; if not, see | 
| 16 |    <http://www.gnu.org/licenses/>.  */ | 
| 17 |  | 
| 18 | #ifndef _SYS_USER_H | 
| 19 | #define _SYS_USER_H	1 | 
| 20 |  | 
| 21 | /* The whole purpose of this file is for GDB and GDB only.  Don't read | 
| 22 |    too much into it.  Don't use it for anything other than GDB unless | 
| 23 |    you know what you are doing.  */ | 
| 24 |  | 
| 25 | #include <unistd.h> | 
| 26 |  | 
| 27 | #ifdef __x86_64__ | 
| 28 |  | 
| 29 | struct user_fpregs_struct | 
| 30 | { | 
| 31 |   unsigned short int	cwd; | 
| 32 |   unsigned short int	swd; | 
| 33 |   unsigned short int	ftw; | 
| 34 |   unsigned short int	fop; | 
| 35 |   __extension__ unsigned long long int rip; | 
| 36 |   __extension__ unsigned long long int rdp; | 
| 37 |   unsigned int		mxcsr; | 
| 38 |   unsigned int		mxcr_mask; | 
| 39 |   unsigned int		st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */ | 
| 40 |   unsigned int		xmm_space[64];  /* 16*16 bytes for each XMM-reg = 256 bytes */ | 
| 41 |   unsigned int		padding[24]; | 
| 42 | }; | 
| 43 |  | 
| 44 | struct user_regs_struct | 
| 45 | { | 
| 46 |   __extension__ unsigned long long int r15; | 
| 47 |   __extension__ unsigned long long int r14; | 
| 48 |   __extension__ unsigned long long int r13; | 
| 49 |   __extension__ unsigned long long int r12; | 
| 50 |   __extension__ unsigned long long int rbp; | 
| 51 |   __extension__ unsigned long long int rbx; | 
| 52 |   __extension__ unsigned long long int r11; | 
| 53 |   __extension__ unsigned long long int r10; | 
| 54 |   __extension__ unsigned long long int r9; | 
| 55 |   __extension__ unsigned long long int r8; | 
| 56 |   __extension__ unsigned long long int rax; | 
| 57 |   __extension__ unsigned long long int rcx; | 
| 58 |   __extension__ unsigned long long int rdx; | 
| 59 |   __extension__ unsigned long long int rsi; | 
| 60 |   __extension__ unsigned long long int rdi; | 
| 61 |   __extension__ unsigned long long int orig_rax; | 
| 62 |   __extension__ unsigned long long int rip; | 
| 63 |   __extension__ unsigned long long int cs; | 
| 64 |   __extension__ unsigned long long int eflags; | 
| 65 |   __extension__ unsigned long long int rsp; | 
| 66 |   __extension__ unsigned long long int ss; | 
| 67 |   __extension__ unsigned long long int fs_base; | 
| 68 |   __extension__ unsigned long long int gs_base; | 
| 69 |   __extension__ unsigned long long int ds; | 
| 70 |   __extension__ unsigned long long int es; | 
| 71 |   __extension__ unsigned long long int fs; | 
| 72 |   __extension__ unsigned long long int gs; | 
| 73 | }; | 
| 74 |  | 
| 75 | struct user | 
| 76 | { | 
| 77 |   struct user_regs_struct	regs; | 
| 78 |   int				u_fpvalid; | 
| 79 |   struct user_fpregs_struct	i387; | 
| 80 |   __extension__ unsigned long long int	u_tsize; | 
| 81 |   __extension__ unsigned long long int	u_dsize; | 
| 82 |   __extension__ unsigned long long int	u_ssize; | 
| 83 |   __extension__ unsigned long long int	start_code; | 
| 84 |   __extension__ unsigned long long int	start_stack; | 
| 85 |   __extension__ long long int		signal; | 
| 86 |   int				reserved; | 
| 87 |   __extension__ union | 
| 88 |     { | 
| 89 |       struct user_regs_struct*	u_ar0; | 
| 90 |       __extension__ unsigned long long int	__u_ar0_word; | 
| 91 |     }; | 
| 92 |   __extension__ union | 
| 93 |     { | 
| 94 |       struct user_fpregs_struct*	u_fpstate; | 
| 95 |       __extension__ unsigned long long int	__u_fpstate_word; | 
| 96 |     }; | 
| 97 |   __extension__ unsigned long long int	magic; | 
| 98 |   char				u_comm [32]; | 
| 99 |   __extension__ unsigned long long int	u_debugreg [8]; | 
| 100 | }; | 
| 101 |  | 
| 102 | #else | 
| 103 | /* These are the 32-bit x86 structures.  */ | 
| 104 | struct user_fpregs_struct | 
| 105 | { | 
| 106 |   long int cwd; | 
| 107 |   long int swd; | 
| 108 |   long int twd; | 
| 109 |   long int fip; | 
| 110 |   long int fcs; | 
| 111 |   long int foo; | 
| 112 |   long int fos; | 
| 113 |   long int st_space [20]; | 
| 114 | }; | 
| 115 |  | 
| 116 | struct user_fpxregs_struct | 
| 117 | { | 
| 118 |   unsigned short int cwd; | 
| 119 |   unsigned short int swd; | 
| 120 |   unsigned short int twd; | 
| 121 |   unsigned short int fop; | 
| 122 |   long int fip; | 
| 123 |   long int fcs; | 
| 124 |   long int foo; | 
| 125 |   long int fos; | 
| 126 |   long int mxcsr; | 
| 127 |   long int reserved; | 
| 128 |   long int st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */ | 
| 129 |   long int xmm_space[32];  /* 8*16 bytes for each XMM-reg = 128 bytes */ | 
| 130 |   long int padding[56]; | 
| 131 | }; | 
| 132 |  | 
| 133 | struct user_regs_struct | 
| 134 | { | 
| 135 |   long int ebx; | 
| 136 |   long int ecx; | 
| 137 |   long int edx; | 
| 138 |   long int esi; | 
| 139 |   long int edi; | 
| 140 |   long int ebp; | 
| 141 |   long int eax; | 
| 142 |   long int xds; | 
| 143 |   long int xes; | 
| 144 |   long int xfs; | 
| 145 |   long int xgs; | 
| 146 |   long int orig_eax; | 
| 147 |   long int eip; | 
| 148 |   long int xcs; | 
| 149 |   long int eflags; | 
| 150 |   long int esp; | 
| 151 |   long int xss; | 
| 152 | }; | 
| 153 |  | 
| 154 | struct user | 
| 155 | { | 
| 156 |   struct user_regs_struct	regs; | 
| 157 |   int				u_fpvalid; | 
| 158 |   struct user_fpregs_struct	i387; | 
| 159 |   unsigned long int		u_tsize; | 
| 160 |   unsigned long int		u_dsize; | 
| 161 |   unsigned long int		u_ssize; | 
| 162 |   unsigned long int		start_code; | 
| 163 |   unsigned long int		start_stack; | 
| 164 |   long int			signal; | 
| 165 |   int				reserved; | 
| 166 |   struct user_regs_struct*	u_ar0; | 
| 167 |   struct user_fpregs_struct*	u_fpstate; | 
| 168 |   unsigned long int		magic; | 
| 169 |   char				u_comm [32]; | 
| 170 |   int				u_debugreg [8]; | 
| 171 | }; | 
| 172 | #endif  /* __x86_64__ */ | 
| 173 |  | 
| 174 | #define PAGE_SHIFT		12 | 
| 175 | #define PAGE_SIZE		(1UL << PAGE_SHIFT) | 
| 176 | #define PAGE_MASK		(~(PAGE_SIZE-1)) | 
| 177 | #define NBPG			PAGE_SIZE | 
| 178 | #define UPAGES			1 | 
| 179 | #define HOST_TEXT_START_ADDR	(u.start_code) | 
| 180 | #define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG) | 
| 181 |  | 
| 182 | #endif	/* _SYS_USER_H */ | 
| 183 |  |