11965aae3SH. Peter Anvin #ifndef _ASM_X86_USER_32_H 21965aae3SH. Peter Anvin #define _ASM_X86_USER_32_H 3bb898558SAl Viro 4bb898558SAl Viro #include <asm/page.h> 5bb898558SAl Viro /* Core file format: The core file is written in such a way that gdb 6bb898558SAl Viro can understand it and provide useful information to the user (under 7bb898558SAl Viro linux we use the 'trad-core' bfd). There are quite a number of 8bb898558SAl Viro obstacles to being able to view the contents of the floating point 9bb898558SAl Viro registers, and until these are solved you will not be able to view the 10bb898558SAl Viro contents of them. Actually, you can read in the core file and look at 11bb898558SAl Viro the contents of the user struct to find out what the floating point 12bb898558SAl Viro registers contain. 13bb898558SAl Viro The actual file contents are as follows: 14bb898558SAl Viro UPAGE: 1 page consisting of a user struct that tells gdb what is present 15bb898558SAl Viro in the file. Directly after this is a copy of the task_struct, which 16bb898558SAl Viro is currently not used by gdb, but it may come in useful at some point. 17bb898558SAl Viro All of the registers are stored as part of the upage. The upage should 18bb898558SAl Viro always be only one page. 19bb898558SAl Viro DATA: The data area is stored. We use current->end_text to 20bb898558SAl Viro current->brk to pick up all of the user variables, plus any memory 21bb898558SAl Viro that may have been malloced. No attempt is made to determine if a page 22bb898558SAl Viro is demand-zero or if a page is totally unused, we just cover the entire 23bb898558SAl Viro range. All of the addresses are rounded in such a way that an integral 24bb898558SAl Viro number of pages is written. 25bb898558SAl Viro STACK: We need the stack information in order to get a meaningful 26bb898558SAl Viro backtrace. We need to write the data from (esp) to 27bb898558SAl Viro current->start_stack, so we round each of these off in order to be able 28bb898558SAl Viro to write an integer number of pages. 29bb898558SAl Viro The minimum core file size is 3 pages, or 12288 bytes. 30bb898558SAl Viro */ 31bb898558SAl Viro 32bb898558SAl Viro /* 33bb898558SAl Viro * Pentium III FXSR, SSE support 34bb898558SAl Viro * Gareth Hughes <gareth@valinux.com>, May 2000 35bb898558SAl Viro * 36bb898558SAl Viro * Provide support for the GDB 5.0+ PTRACE_{GET|SET}FPXREGS requests for 37bb898558SAl Viro * interacting with the FXSR-format floating point environment. Floating 38bb898558SAl Viro * point data can be accessed in the regular format in the usual manner, 39bb898558SAl Viro * and both the standard and SIMD floating point data can be accessed via 40bb898558SAl Viro * the new ptrace requests. In either case, changes to the FPU environment 41bb898558SAl Viro * will be reflected in the task's state as expected. 42bb898558SAl Viro */ 43bb898558SAl Viro 44bb898558SAl Viro struct user_i387_struct { 45bb898558SAl Viro long cwd; 46bb898558SAl Viro long swd; 47bb898558SAl Viro long twd; 48bb898558SAl Viro long fip; 49bb898558SAl Viro long fcs; 50bb898558SAl Viro long foo; 51bb898558SAl Viro long fos; 52bb898558SAl Viro long st_space[20]; /* 8*10 bytes for each FP-reg = 80 bytes */ 53bb898558SAl Viro }; 54bb898558SAl Viro 55bb898558SAl Viro struct user_fxsr_struct { 56bb898558SAl Viro unsigned short cwd; 57bb898558SAl Viro unsigned short swd; 58bb898558SAl Viro unsigned short twd; 59bb898558SAl Viro unsigned short fop; 60bb898558SAl Viro long fip; 61bb898558SAl Viro long fcs; 62bb898558SAl Viro long foo; 63bb898558SAl Viro long fos; 64bb898558SAl Viro long mxcsr; 65bb898558SAl Viro long reserved; 66bb898558SAl Viro long st_space[32]; /* 8*16 bytes for each FP-reg = 128 bytes */ 67bb898558SAl Viro long xmm_space[32]; /* 8*16 bytes for each XMM-reg = 128 bytes */ 68bb898558SAl Viro long padding[56]; 69bb898558SAl Viro }; 70bb898558SAl Viro 71bb898558SAl Viro /* 72bb898558SAl Viro * This is the old layout of "struct pt_regs", and 73bb898558SAl Viro * is still the layout used by user mode (the new 74bb898558SAl Viro * pt_regs doesn't have all registers as the kernel 75bb898558SAl Viro * doesn't use the extra segment registers) 76bb898558SAl Viro */ 77bb898558SAl Viro struct user_regs_struct { 78bb898558SAl Viro unsigned long bx; 79bb898558SAl Viro unsigned long cx; 80bb898558SAl Viro unsigned long dx; 81bb898558SAl Viro unsigned long si; 82bb898558SAl Viro unsigned long di; 83bb898558SAl Viro unsigned long bp; 84bb898558SAl Viro unsigned long ax; 85bb898558SAl Viro unsigned long ds; 86bb898558SAl Viro unsigned long es; 87bb898558SAl Viro unsigned long fs; 88bb898558SAl Viro unsigned long gs; 89bb898558SAl Viro unsigned long orig_ax; 90bb898558SAl Viro unsigned long ip; 91bb898558SAl Viro unsigned long cs; 92bb898558SAl Viro unsigned long flags; 93bb898558SAl Viro unsigned long sp; 94bb898558SAl Viro unsigned long ss; 95bb898558SAl Viro }; 96bb898558SAl Viro 97bb898558SAl Viro /* When the kernel dumps core, it starts by dumping the user struct - 98bb898558SAl Viro this will be used by gdb to figure out where the data and stack segments 99bb898558SAl Viro are within the file, and what virtual addresses to use. */ 100bb898558SAl Viro struct user{ 101bb898558SAl Viro /* We start with the registers, to mimic the way that "memory" is returned 102bb898558SAl Viro from the ptrace(3,...) function. */ 103bb898558SAl Viro struct user_regs_struct regs; /* Where the registers are actually stored */ 104bb898558SAl Viro /* ptrace does not yet supply these. Someday.... */ 105bb898558SAl Viro int u_fpvalid; /* True if math co-processor being used. */ 106bb898558SAl Viro /* for this mess. Not yet used. */ 107bb898558SAl Viro struct user_i387_struct i387; /* Math Co-processor registers. */ 108bb898558SAl Viro /* The rest of this junk is to help gdb figure out what goes where */ 109bb898558SAl Viro unsigned long int u_tsize; /* Text segment size (pages). */ 110bb898558SAl Viro unsigned long int u_dsize; /* Data segment size (pages). */ 111bb898558SAl Viro unsigned long int u_ssize; /* Stack segment size (pages). */ 112bb898558SAl Viro unsigned long start_code; /* Starting virtual address of text. */ 113bb898558SAl Viro unsigned long start_stack; /* Starting virtual address of stack area. 114bb898558SAl Viro This is actually the bottom of the stack, 115bb898558SAl Viro the top of the stack is always found in the 116bb898558SAl Viro esp register. */ 117bb898558SAl Viro long int signal; /* Signal that caused the core dump. */ 118bb898558SAl Viro int reserved; /* No longer used */ 119bb898558SAl Viro unsigned long u_ar0; /* Used by gdb to help find the values for */ 120bb898558SAl Viro /* the registers. */ 121bb898558SAl Viro struct user_i387_struct *u_fpstate; /* Math Co-processor pointer. */ 122bb898558SAl Viro unsigned long magic; /* To uniquely identify a core file */ 123bb898558SAl Viro char u_comm[32]; /* User command that was responsible */ 124bb898558SAl Viro int u_debugreg[8]; 125bb898558SAl Viro }; 126bb898558SAl Viro #define NBPG PAGE_SIZE 127bb898558SAl Viro #define UPAGES 1 128bb898558SAl Viro #define HOST_TEXT_START_ADDR (u.start_code) 129bb898558SAl Viro #define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG) 130bb898558SAl Viro 1311965aae3SH. Peter Anvin #endif /* _ASM_X86_USER_32_H */ 132