Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ASM_X86_USER_64_H
0003 #define _ASM_X86_USER_64_H
0004 
0005 #include <asm/types.h>
0006 #include <asm/page.h>
0007 /* Core file format: The core file is written in such a way that gdb
0008    can understand it and provide useful information to the user.
0009    There are quite a number of obstacles to being able to view the
0010    contents of the floating point registers, and until these are
0011    solved you will not be able to view the contents of them.
0012    Actually, you can read in the core file and look at the contents of
0013    the user struct to find out what the floating point registers
0014    contain.
0015 
0016    The actual file contents are as follows:
0017    UPAGE: 1 page consisting of a user struct that tells gdb what is present
0018    in the file.  Directly after this is a copy of the task_struct, which
0019    is currently not used by gdb, but it may come in useful at some point.
0020    All of the registers are stored as part of the upage.  The upage should
0021    always be only one page.
0022    DATA: The data area is stored.  We use current->end_text to
0023    current->brk to pick up all of the user variables, plus any memory
0024    that may have been malloced.  No attempt is made to determine if a page
0025    is demand-zero or if a page is totally unused, we just cover the entire
0026    range.  All of the addresses are rounded in such a way that an integral
0027    number of pages is written.
0028    STACK: We need the stack information in order to get a meaningful
0029    backtrace.  We need to write the data from (esp) to
0030    current->start_stack, so we round each of these off in order to be able
0031    to write an integer number of pages.
0032    The minimum core file size is 3 pages, or 12288 bytes.  */
0033 
0034 /*
0035  * Pentium III FXSR, SSE support
0036  *  Gareth Hughes <gareth@valinux.com>, May 2000
0037  *
0038  * Provide support for the GDB 5.0+ PTRACE_{GET|SET}FPXREGS requests for
0039  * interacting with the FXSR-format floating point environment.  Floating
0040  * point data can be accessed in the regular format in the usual manner,
0041  * and both the standard and SIMD floating point data can be accessed via
0042  * the new ptrace requests.  In either case, changes to the FPU environment
0043  * will be reflected in the task's state as expected.
0044  *
0045  * x86-64 support by Andi Kleen.
0046  */
0047 
0048 /* This matches the 64bit FXSAVE format as defined by AMD. It is the same
0049    as the 32bit format defined by Intel, except that the selector:offset pairs
0050    for data and eip are replaced with flat 64bit pointers. */
0051 struct user_i387_struct {
0052     unsigned short  cwd;
0053     unsigned short  swd;
0054     unsigned short  twd;    /* Note this is not the same as
0055                    the 32bit/x87/FSAVE twd */
0056     unsigned short  fop;
0057     __u64   rip;
0058     __u64   rdp;
0059     __u32   mxcsr;
0060     __u32   mxcsr_mask;
0061     __u32   st_space[32];   /* 8*16 bytes for each FP-reg = 128 bytes */
0062     __u32   xmm_space[64];  /* 16*16 bytes for each XMM-reg = 256 bytes */
0063     __u32   padding[24];
0064 };
0065 
0066 /*
0067  * Segment register layout in coredumps.
0068  */
0069 struct user_regs_struct {
0070     unsigned long   r15;
0071     unsigned long   r14;
0072     unsigned long   r13;
0073     unsigned long   r12;
0074     unsigned long   bp;
0075     unsigned long   bx;
0076     unsigned long   r11;
0077     unsigned long   r10;
0078     unsigned long   r9;
0079     unsigned long   r8;
0080     unsigned long   ax;
0081     unsigned long   cx;
0082     unsigned long   dx;
0083     unsigned long   si;
0084     unsigned long   di;
0085     unsigned long   orig_ax;
0086     unsigned long   ip;
0087     unsigned long   cs;
0088     unsigned long   flags;
0089     unsigned long   sp;
0090     unsigned long   ss;
0091     unsigned long   fs_base;
0092     unsigned long   gs_base;
0093     unsigned long   ds;
0094     unsigned long   es;
0095     unsigned long   fs;
0096     unsigned long   gs;
0097 };
0098 
0099 /* When the kernel dumps core, it starts by dumping the user struct -
0100    this will be used by gdb to figure out where the data and stack segments
0101    are within the file, and what virtual addresses to use. */
0102 
0103 struct user {
0104 /* We start with the registers, to mimic the way that "memory" is returned
0105    from the ptrace(3,...) function.  */
0106   struct user_regs_struct regs; /* Where the registers are actually stored */
0107 /* ptrace does not yet supply these.  Someday.... */
0108   int u_fpvalid;        /* True if math co-processor being used. */
0109                 /* for this mess. Not yet used. */
0110   int pad0;
0111   struct user_i387_struct i387; /* Math Co-processor registers. */
0112 /* The rest of this junk is to help gdb figure out what goes where */
0113   unsigned long int u_tsize;    /* Text segment size (pages). */
0114   unsigned long int u_dsize;    /* Data segment size (pages). */
0115   unsigned long int u_ssize;    /* Stack segment size (pages). */
0116   unsigned long start_code;     /* Starting virtual address of text. */
0117   unsigned long start_stack;    /* Starting virtual address of stack area.
0118                    This is actually the bottom of the stack,
0119                    the top of the stack is always found in the
0120                    esp register.  */
0121   long int signal;      /* Signal that caused the core dump. */
0122   int reserved;         /* No longer used */
0123   int pad1;
0124   unsigned long u_ar0;      /* Used by gdb to help find the values for */
0125                 /* the registers. */
0126   struct user_i387_struct *u_fpstate;   /* Math Co-processor pointer. */
0127   unsigned long magic;      /* To uniquely identify a core file */
0128   char u_comm[32];      /* User command that was responsible */
0129   unsigned long u_debugreg[8];
0130   unsigned long error_code; /* CPU error code or 0 */
0131   unsigned long fault_address; /* CR3 or 0 */
0132 };
0133 
0134 #endif /* _ASM_X86_USER_64_H */