Home | History | Annotate | Download | only in sys
      1 /* Copyright (C) 2001, 2002, 2004, 2011 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, write to the Free
     16    Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
     17    02111-1307 USA.  */
     18 
     19 #ifndef _SYS_USER_H
     20 #define _SYS_USER_H	1
     21 
     22 /* The whole purpose of this file is for GDB and GDB only.  Don't read
     23    too much into it.  Don't use it for anything other than GDB unless
     24    you know what you are doing.  */
     25 
     26 #include <bits/wordsize.h>
     27 #include <unistd.h>
     28 
     29 #if __WORDSIZE == 64
     30 
     31 struct user_fpregs_struct
     32 {
     33   unsigned short int	cwd;
     34   unsigned short int	swd;
     35   unsigned short int	ftw;
     36   unsigned short int	fop;
     37   unsigned long int	rip;
     38   unsigned long int	rdp;
     39   unsigned int		mxcsr;
     40   unsigned int		mxcr_mask;
     41   unsigned int		st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
     42   unsigned int		xmm_space[64];  /* 16*16 bytes for each XMM-reg = 256 bytes */
     43   unsigned int		padding[24];
     44 };
     45 
     46 struct user_regs_struct
     47 {
     48   unsigned long int r15;
     49   unsigned long int r14;
     50   unsigned long int r13;
     51   unsigned long int r12;
     52   unsigned long int rbp;
     53   unsigned long int rbx;
     54   unsigned long int r11;
     55   unsigned long int r10;
     56   unsigned long int r9;
     57   unsigned long int r8;
     58   unsigned long int rax;
     59   unsigned long int rcx;
     60   unsigned long int rdx;
     61   unsigned long int rsi;
     62   unsigned long int rdi;
     63   unsigned long int orig_rax;
     64   unsigned long int rip;
     65   unsigned long int cs;
     66   unsigned long int eflags;
     67   unsigned long int rsp;
     68   unsigned long int ss;
     69   unsigned long int fs_base;
     70   unsigned long int gs_base;
     71   unsigned long int ds;
     72   unsigned long int es;
     73   unsigned long int fs;
     74   unsigned long int gs;
     75 };
     76 
     77 struct user
     78 {
     79   struct user_regs_struct	regs;
     80   int				u_fpvalid;
     81   struct user_fpregs_struct	i387;
     82   unsigned long int		u_tsize;
     83   unsigned long int		u_dsize;
     84   unsigned long int		u_ssize;
     85   unsigned long int		start_code;
     86   unsigned long int		start_stack;
     87   long int			signal;
     88   int				reserved;
     89   struct user_regs_struct*	u_ar0;
     90   struct user_fpregs_struct*	u_fpstate;
     91   unsigned long int		magic;
     92   char				u_comm [32];
     93   unsigned long int		u_debugreg [8];
     94 };
     95 
     96 #else
     97 /* These are the 32-bit x86 structures.  */
     98 struct user_fpregs_struct
     99 {
    100   long int cwd;
    101   long int swd;
    102   long int twd;
    103   long int fip;
    104   long int fcs;
    105   long int foo;
    106   long int fos;
    107   long int st_space [20];
    108 };
    109 
    110 struct user_fpxregs_struct
    111 {
    112   unsigned short int cwd;
    113   unsigned short int swd;
    114   unsigned short int twd;
    115   unsigned short int fop;
    116   long int fip;
    117   long int fcs;
    118   long int foo;
    119   long int fos;
    120   long int mxcsr;
    121   long int reserved;
    122   long int st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
    123   long int xmm_space[32];  /* 8*16 bytes for each XMM-reg = 128 bytes */
    124   long int padding[56];
    125 };
    126 
    127 struct user_regs_struct
    128 {
    129   long int ebx;
    130   long int ecx;
    131   long int edx;
    132   long int esi;
    133   long int edi;
    134   long int ebp;
    135   long int eax;
    136   long int xds;
    137   long int xes;
    138   long int xfs;
    139   long int xgs;
    140   long int orig_eax;
    141   long int eip;
    142   long int xcs;
    143   long int eflags;
    144   long int esp;
    145   long int xss;
    146 };
    147 
    148 struct user
    149 {
    150   struct user_regs_struct	regs;
    151   int				u_fpvalid;
    152   struct user_fpregs_struct	i387;
    153   unsigned long int		u_tsize;
    154   unsigned long int		u_dsize;
    155   unsigned long int		u_ssize;
    156   unsigned long int		start_code;
    157   unsigned long int		start_stack;
    158   long int			signal;
    159   int				reserved;
    160   struct user_regs_struct*	u_ar0;
    161   struct user_fpregs_struct*	u_fpstate;
    162   unsigned long int		magic;
    163   char				u_comm [32];
    164   int				u_debugreg [8];
    165 };
    166 #endif  /* __WORDSIZE */
    167 
    168 #define PAGE_SIZE		(sysconf(_SC_PAGESIZE))
    169 #define PAGE_MASK		(~(PAGE_SIZE-1))
    170 #define NBPG			PAGE_SIZE
    171 #define UPAGES			1
    172 #define HOST_TEXT_START_ADDR	(u.start_code)
    173 #define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
    174 
    175 #endif	/* _SYS_USER_H */
    176