162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 262306a36Sopenharmony_ci#ifndef _ARM_USER_H 362306a36Sopenharmony_ci#define _ARM_USER_H 462306a36Sopenharmony_ci 562306a36Sopenharmony_ci#include <asm/page.h> 662306a36Sopenharmony_ci#include <asm/ptrace.h> 762306a36Sopenharmony_ci/* Core file format: The core file is written in such a way that gdb 862306a36Sopenharmony_ci can understand it and provide useful information to the user (under 962306a36Sopenharmony_ci linux we use the 'trad-core' bfd). There are quite a number of 1062306a36Sopenharmony_ci obstacles to being able to view the contents of the floating point 1162306a36Sopenharmony_ci registers, and until these are solved you will not be able to view the 1262306a36Sopenharmony_ci contents of them. Actually, you can read in the core file and look at 1362306a36Sopenharmony_ci the contents of the user struct to find out what the floating point 1462306a36Sopenharmony_ci registers contain. 1562306a36Sopenharmony_ci The actual file contents are as follows: 1662306a36Sopenharmony_ci UPAGE: 1 page consisting of a user struct that tells gdb what is present 1762306a36Sopenharmony_ci in the file. Directly after this is a copy of the task_struct, which 1862306a36Sopenharmony_ci is currently not used by gdb, but it may come in useful at some point. 1962306a36Sopenharmony_ci All of the registers are stored as part of the upage. The upage should 2062306a36Sopenharmony_ci always be only one page. 2162306a36Sopenharmony_ci DATA: The data area is stored. We use current->end_text to 2262306a36Sopenharmony_ci current->brk to pick up all of the user variables, plus any memory 2362306a36Sopenharmony_ci that may have been malloced. No attempt is made to determine if a page 2462306a36Sopenharmony_ci is demand-zero or if a page is totally unused, we just cover the entire 2562306a36Sopenharmony_ci range. All of the addresses are rounded in such a way that an integral 2662306a36Sopenharmony_ci number of pages is written. 2762306a36Sopenharmony_ci STACK: We need the stack information in order to get a meaningful 2862306a36Sopenharmony_ci backtrace. We need to write the data from (esp) to 2962306a36Sopenharmony_ci current->start_stack, so we round each of these off in order to be able 3062306a36Sopenharmony_ci to write an integer number of pages. 3162306a36Sopenharmony_ci The minimum core file size is 3 pages, or 12288 bytes. 3262306a36Sopenharmony_ci*/ 3362306a36Sopenharmony_ci 3462306a36Sopenharmony_cistruct user_fp { 3562306a36Sopenharmony_ci struct fp_reg { 3662306a36Sopenharmony_ci unsigned int sign1:1; 3762306a36Sopenharmony_ci unsigned int unused:15; 3862306a36Sopenharmony_ci unsigned int sign2:1; 3962306a36Sopenharmony_ci unsigned int exponent:14; 4062306a36Sopenharmony_ci unsigned int j:1; 4162306a36Sopenharmony_ci unsigned int mantissa1:31; 4262306a36Sopenharmony_ci unsigned int mantissa0:32; 4362306a36Sopenharmony_ci } fpregs[8]; 4462306a36Sopenharmony_ci unsigned int fpsr:32; 4562306a36Sopenharmony_ci unsigned int fpcr:32; 4662306a36Sopenharmony_ci unsigned char ftype[8]; 4762306a36Sopenharmony_ci unsigned int init_flag; 4862306a36Sopenharmony_ci}; 4962306a36Sopenharmony_ci 5062306a36Sopenharmony_ci/* When the kernel dumps core, it starts by dumping the user struct - 5162306a36Sopenharmony_ci this will be used by gdb to figure out where the data and stack segments 5262306a36Sopenharmony_ci are within the file, and what virtual addresses to use. */ 5362306a36Sopenharmony_cistruct user{ 5462306a36Sopenharmony_ci/* We start with the registers, to mimic the way that "memory" is returned 5562306a36Sopenharmony_ci from the ptrace(3,...) function. */ 5662306a36Sopenharmony_ci struct pt_regs regs; /* Where the registers are actually stored */ 5762306a36Sopenharmony_ci/* ptrace does not yet supply these. Someday.... */ 5862306a36Sopenharmony_ci int u_fpvalid; /* True if math co-processor being used. */ 5962306a36Sopenharmony_ci /* for this mess. Not yet used. */ 6062306a36Sopenharmony_ci/* The rest of this junk is to help gdb figure out what goes where */ 6162306a36Sopenharmony_ci unsigned long int u_tsize; /* Text segment size (pages). */ 6262306a36Sopenharmony_ci unsigned long int u_dsize; /* Data segment size (pages). */ 6362306a36Sopenharmony_ci unsigned long int u_ssize; /* Stack segment size (pages). */ 6462306a36Sopenharmony_ci unsigned long start_code; /* Starting virtual address of text. */ 6562306a36Sopenharmony_ci unsigned long start_stack; /* Starting virtual address of stack area. 6662306a36Sopenharmony_ci This is actually the bottom of the stack, 6762306a36Sopenharmony_ci the top of the stack is always found in the 6862306a36Sopenharmony_ci esp register. */ 6962306a36Sopenharmony_ci long int signal; /* Signal that caused the core dump. */ 7062306a36Sopenharmony_ci int reserved; /* No longer used */ 7162306a36Sopenharmony_ci unsigned long u_ar0; /* Used by gdb to help find the values for */ 7262306a36Sopenharmony_ci /* the registers. */ 7362306a36Sopenharmony_ci unsigned long magic; /* To uniquely identify a core file */ 7462306a36Sopenharmony_ci char u_comm[32]; /* User command that was responsible */ 7562306a36Sopenharmony_ci int u_debugreg[8]; /* No longer used */ 7662306a36Sopenharmony_ci struct user_fp u_fp; /* FP state */ 7762306a36Sopenharmony_ci struct user_fp_struct * u_fp0;/* Used by gdb to help find the values for */ 7862306a36Sopenharmony_ci /* the FP registers. */ 7962306a36Sopenharmony_ci}; 8062306a36Sopenharmony_ci 8162306a36Sopenharmony_ci/* 8262306a36Sopenharmony_ci * User specific VFP registers. If only VFPv2 is present, registers 16 to 31 8362306a36Sopenharmony_ci * are ignored by the ptrace system call and the signal handler. 8462306a36Sopenharmony_ci */ 8562306a36Sopenharmony_cistruct user_vfp { 8662306a36Sopenharmony_ci unsigned long long fpregs[32]; 8762306a36Sopenharmony_ci unsigned long fpscr; 8862306a36Sopenharmony_ci}; 8962306a36Sopenharmony_ci 9062306a36Sopenharmony_ci/* 9162306a36Sopenharmony_ci * VFP exception registers exposed to user space during signal delivery. 9262306a36Sopenharmony_ci * Fields not relavant to the current VFP architecture are ignored. 9362306a36Sopenharmony_ci */ 9462306a36Sopenharmony_cistruct user_vfp_exc { 9562306a36Sopenharmony_ci unsigned long fpexc; 9662306a36Sopenharmony_ci unsigned long fpinst; 9762306a36Sopenharmony_ci unsigned long fpinst2; 9862306a36Sopenharmony_ci}; 9962306a36Sopenharmony_ci 10062306a36Sopenharmony_ci#endif /* _ARM_USER_H */ 101