Back to index

glibc  2.9
user.h
Go to the documentation of this file.
00001 /* Copyright (C) 2001, 2002, 2004 Free Software Foundation, Inc.
00002    This file is part of the GNU C Library.
00003 
00004    The GNU C Library is free software; you can redistribute it and/or
00005    modify it under the terms of the GNU Lesser General Public
00006    License as published by the Free Software Foundation; either
00007    version 2.1 of the License, or (at your option) any later version.
00008 
00009    The GNU C Library is distributed in the hope that it will be useful,
00010    but WITHOUT ANY WARRANTY; without even the implied warranty of
00011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012    Lesser General Public License for more details.
00013 
00014    You should have received a copy of the GNU Lesser General Public
00015    License along with the GNU C Library; if not, write to the Free
00016    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
00017    02111-1307 USA.  */
00018 
00019 #ifndef _SYS_USER_H
00020 #define _SYS_USER_H  1
00021 
00022 /* The whole purpose of this file is for GDB and GDB only.  Don't read
00023    too much into it.  Don't use it for anything other than GDB unless
00024    you know what you are doing.  */
00025 
00026 #include <bits/wordsize.h>
00027 
00028 #if __WORDSIZE == 64
00029 
00030 struct user_fpregs_struct
00031 {
00032   __uint16_t         cwd;
00033   __uint16_t         swd;
00034   __uint16_t         ftw;
00035   __uint16_t         fop;
00036   __uint64_t         rip;
00037   __uint64_t         rdp;
00038   __uint32_t         mxcsr;
00039   __uint32_t         mxcr_mask;
00040   __uint32_t         st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
00041   __uint32_t         xmm_space[64];  /* 16*16 bytes for each XMM-reg = 256 bytes */
00042   __uint32_t         padding[24];
00043 };
00044 
00045 struct user_regs_struct
00046 {
00047   unsigned long r15;
00048   unsigned long r14;
00049   unsigned long r13;
00050   unsigned long r12;
00051   unsigned long rbp;
00052   unsigned long rbx;
00053   unsigned long r11;
00054   unsigned long r10;
00055   unsigned long r9;
00056   unsigned long r8;
00057   unsigned long rax;
00058   unsigned long rcx;
00059   unsigned long rdx;
00060   unsigned long rsi;
00061   unsigned long rdi;
00062   unsigned long orig_rax;
00063   unsigned long rip;
00064   unsigned long cs;
00065   unsigned long eflags;
00066   unsigned long rsp;
00067   unsigned long ss;
00068   unsigned long fs_base;
00069   unsigned long gs_base;
00070   unsigned long ds;
00071   unsigned long es;
00072   unsigned long fs;
00073   unsigned long gs;
00074 };
00075 
00076 struct user
00077 {
00078   struct user_regs_struct   regs;
00079   int                       u_fpvalid;
00080   struct user_fpregs_struct i387;
00081   unsigned long int         u_tsize;
00082   unsigned long int         u_dsize;
00083   unsigned long int         u_ssize;
00084   unsigned long                    start_code;
00085   unsigned long                    start_stack;
00086   long int                  signal;
00087   int                       reserved;
00088   struct user_regs_struct*  u_ar0;
00089   struct user_fpregs_struct*       u_fpstate;
00090   unsigned long int         magic;
00091   char                      u_comm [32];
00092   unsigned long int         u_debugreg [8];
00093 };
00094 
00095 #else
00096 /* These are the 32-bit x86 structures.  */
00097 struct user_fpregs_struct
00098 {
00099   long int cwd;
00100   long int swd;
00101   long int twd;
00102   long int fip;
00103   long int fcs;
00104   long int foo;
00105   long int fos;
00106   long int st_space [20];
00107 };
00108 
00109 struct user_fpxregs_struct
00110 {
00111   unsigned short int cwd;
00112   unsigned short int swd;
00113   unsigned short int twd;
00114   unsigned short int fop;
00115   long int fip;
00116   long int fcs;
00117   long int foo;
00118   long int fos;
00119   long int mxcsr;
00120   long int reserved;
00121   long int st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
00122   long int xmm_space[32];  /* 8*16 bytes for each XMM-reg = 128 bytes */
00123   long int padding[56];
00124 };
00125 
00126 struct user_regs_struct
00127 {
00128   long int ebx;
00129   long int ecx;
00130   long int edx;
00131   long int esi;
00132   long int edi;
00133   long int ebp;
00134   long int eax;
00135   long int xds;
00136   long int xes;
00137   long int xfs;
00138   long int xgs;
00139   long int orig_eax;
00140   long int eip;
00141   long int xcs;
00142   long int eflags;
00143   long int esp;
00144   long int xss;
00145 };
00146 
00147 struct user
00148 {
00149   struct user_regs_struct   regs;
00150   int                       u_fpvalid;
00151   struct user_fpregs_struct i387;
00152   unsigned long int         u_tsize;
00153   unsigned long int         u_dsize;
00154   unsigned long int         u_ssize;
00155   unsigned long                    start_code;
00156   unsigned long                    start_stack;
00157   long int                  signal;
00158   int                       reserved;
00159   struct user_regs_struct*  u_ar0;
00160   struct user_fpregs_struct*       u_fpstate;
00161   unsigned long int         magic;
00162   char                      u_comm [32];
00163   int                       u_debugreg [8];
00164 };
00165 #endif  /* __WORDSIZE */
00166 
00167 #define PAGE_SHIFT          12
00168 #define PAGE_SIZE           (1UL << PAGE_SHIFT)
00169 #define PAGE_MASK           (~(PAGE_SIZE-1))
00170 #define NBPG                PAGE_SIZE
00171 #define UPAGES                     1
00172 #define HOST_TEXT_START_ADDR       (u.start_code)
00173 #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
00174 
00175 #endif /* _SYS_USER_H */