Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _ARM_USER_H
0003 #define _ARM_USER_H
0004 
0005 #include <asm/page.h>
0006 #include <asm/ptrace.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 (under
0009    linux we use the 'trad-core' bfd).  There are quite a number of
0010    obstacles to being able to view the contents of the floating point
0011    registers, and until these are solved you will not be able to view the
0012    contents of them.  Actually, you can read in the core file and look at
0013    the contents of the user struct to find out what the floating point
0014    registers contain.
0015    The actual file contents are as follows:
0016    UPAGE: 1 page consisting of a user struct that tells gdb what is present
0017    in the file.  Directly after this is a copy of the task_struct, which
0018    is currently not used by gdb, but it may come in useful at some point.
0019    All of the registers are stored as part of the upage.  The upage should
0020    always be only one page.
0021    DATA: The data area is stored.  We use current->end_text to
0022    current->brk to pick up all of the user variables, plus any memory
0023    that may have been malloced.  No attempt is made to determine if a page
0024    is demand-zero or if a page is totally unused, we just cover the entire
0025    range.  All of the addresses are rounded in such a way that an integral
0026    number of pages is written.
0027    STACK: We need the stack information in order to get a meaningful
0028    backtrace.  We need to write the data from (esp) to
0029    current->start_stack, so we round each of these off in order to be able
0030    to write an integer number of pages.
0031    The minimum core file size is 3 pages, or 12288 bytes.
0032 */
0033 
0034 struct user_fp {
0035     struct fp_reg {
0036         unsigned int sign1:1;
0037         unsigned int unused:15;
0038         unsigned int sign2:1;
0039         unsigned int exponent:14;
0040         unsigned int j:1;
0041         unsigned int mantissa1:31;
0042         unsigned int mantissa0:32;
0043     } fpregs[8];
0044     unsigned int fpsr:32;
0045     unsigned int fpcr:32;
0046     unsigned char ftype[8];
0047     unsigned int init_flag;
0048 };
0049 
0050 /* When the kernel dumps core, it starts by dumping the user struct -
0051    this will be used by gdb to figure out where the data and stack segments
0052    are within the file, and what virtual addresses to use. */
0053 struct user{
0054 /* We start with the registers, to mimic the way that "memory" is returned
0055    from the ptrace(3,...) function.  */
0056   struct pt_regs regs;      /* Where the registers are actually stored */
0057 /* ptrace does not yet supply these.  Someday.... */
0058   int u_fpvalid;        /* True if math co-processor being used. */
0059                                 /* for this mess. Not yet used. */
0060 /* The rest of this junk is to help gdb figure out what goes where */
0061   unsigned long int u_tsize;    /* Text segment size (pages). */
0062   unsigned long int u_dsize;    /* Data segment size (pages). */
0063   unsigned long int u_ssize;    /* Stack segment size (pages). */
0064   unsigned long start_code;     /* Starting virtual address of text. */
0065   unsigned long start_stack;    /* Starting virtual address of stack area.
0066                    This is actually the bottom of the stack,
0067                    the top of the stack is always found in the
0068                    esp register.  */
0069   long int signal;          /* Signal that caused the core dump. */
0070   int reserved;         /* No longer used */
0071   unsigned long u_ar0;      /* Used by gdb to help find the values for */
0072                 /* the registers. */
0073   unsigned long magic;      /* To uniquely identify a core file */
0074   char u_comm[32];      /* User command that was responsible */
0075   int u_debugreg[8];        /* No longer used */
0076   struct user_fp u_fp;      /* FP state */
0077   struct user_fp_struct * u_fp0;/* Used by gdb to help find the values for */
0078                 /* the FP registers. */
0079 };
0080 
0081 /*
0082  * User specific VFP registers. If only VFPv2 is present, registers 16 to 31
0083  * are ignored by the ptrace system call and the signal handler.
0084  */
0085 struct user_vfp {
0086     unsigned long long fpregs[32];
0087     unsigned long fpscr;
0088 };
0089 
0090 /*
0091  * VFP exception registers exposed to user space during signal delivery.
0092  * Fields not relavant to the current VFP architecture are ignored.
0093  */
0094 struct user_vfp_exc {
0095     unsigned long   fpexc;
0096     unsigned long   fpinst;
0097     unsigned long   fpinst2;
0098 };
0099 
0100 #endif /* _ARM_USER_H */