162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */
262306a36Sopenharmony_ci#ifndef _M68K_USER_H
362306a36Sopenharmony_ci#define _M68K_USER_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_ci/* Core file format: The core file is written in such a way that gdb
662306a36Sopenharmony_ci   can understand it and provide useful information to the user (under
762306a36Sopenharmony_ci   linux we use the 'trad-core' bfd).  There are quite a number of
862306a36Sopenharmony_ci   obstacles to being able to view the contents of the floating point
962306a36Sopenharmony_ci   registers, and until these are solved you will not be able to view the
1062306a36Sopenharmony_ci   contents of them.  Actually, you can read in the core file and look at
1162306a36Sopenharmony_ci   the contents of the user struct to find out what the floating point
1262306a36Sopenharmony_ci   registers contain.
1362306a36Sopenharmony_ci   The actual file contents are as follows:
1462306a36Sopenharmony_ci   UPAGE: 1 page consisting of a user struct that tells gdb what is present
1562306a36Sopenharmony_ci   in the file.  Directly after this is a copy of the task_struct, which
1662306a36Sopenharmony_ci   is currently not used by gdb, but it may come in useful at some point.
1762306a36Sopenharmony_ci   All of the registers are stored as part of the upage.  The upage should
1862306a36Sopenharmony_ci   always be only one page.
1962306a36Sopenharmony_ci   DATA: The data area is stored.  We use current->end_text to
2062306a36Sopenharmony_ci   current->brk to pick up all of the user variables, plus any memory
2162306a36Sopenharmony_ci   that may have been malloced.  No attempt is made to determine if a page
2262306a36Sopenharmony_ci   is demand-zero or if a page is totally unused, we just cover the entire
2362306a36Sopenharmony_ci   range.  All of the addresses are rounded in such a way that an integral
2462306a36Sopenharmony_ci   number of pages is written.
2562306a36Sopenharmony_ci   STACK: We need the stack information in order to get a meaningful
2662306a36Sopenharmony_ci   backtrace.  We need to write the data from (esp) to
2762306a36Sopenharmony_ci   current->start_stack, so we round each of these off in order to be able
2862306a36Sopenharmony_ci   to write an integer number of pages.
2962306a36Sopenharmony_ci   The minimum core file size is 3 pages, or 12288 bytes.
3062306a36Sopenharmony_ci*/
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_cistruct user_m68kfp_struct {
3362306a36Sopenharmony_ci	unsigned long  fpregs[8*3];	/* fp0-fp7 registers */
3462306a36Sopenharmony_ci	unsigned long  fpcntl[3];	/* fp control regs */
3562306a36Sopenharmony_ci};
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_ci/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
3862306a36Sopenharmony_ci   is still the layout used by user (the new pt_regs doesn't have
3962306a36Sopenharmony_ci   all registers). */
4062306a36Sopenharmony_cistruct user_regs_struct {
4162306a36Sopenharmony_ci	long d1,d2,d3,d4,d5,d6,d7;
4262306a36Sopenharmony_ci	long a0,a1,a2,a3,a4,a5,a6;
4362306a36Sopenharmony_ci	long d0;
4462306a36Sopenharmony_ci	long usp;
4562306a36Sopenharmony_ci	long orig_d0;
4662306a36Sopenharmony_ci	short stkadj;
4762306a36Sopenharmony_ci	short sr;
4862306a36Sopenharmony_ci	long pc;
4962306a36Sopenharmony_ci	short fmtvec;
5062306a36Sopenharmony_ci	short __fill;
5162306a36Sopenharmony_ci};
5262306a36Sopenharmony_ci
5362306a36Sopenharmony_ci
5462306a36Sopenharmony_ci/* When the kernel dumps core, it starts by dumping the user struct -
5562306a36Sopenharmony_ci   this will be used by gdb to figure out where the data and stack segments
5662306a36Sopenharmony_ci   are within the file, and what virtual addresses to use. */
5762306a36Sopenharmony_cistruct user{
5862306a36Sopenharmony_ci/* We start with the registers, to mimic the way that "memory" is returned
5962306a36Sopenharmony_ci   from the ptrace(3,...) function.  */
6062306a36Sopenharmony_ci  struct user_regs_struct regs;	/* Where the registers are actually stored */
6162306a36Sopenharmony_ci/* ptrace does not yet supply these.  Someday.... */
6262306a36Sopenharmony_ci  int u_fpvalid;		/* True if math co-processor being used. */
6362306a36Sopenharmony_ci                                /* for this mess. Not yet used. */
6462306a36Sopenharmony_ci  struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
6562306a36Sopenharmony_ci/* The rest of this junk is to help gdb figure out what goes where */
6662306a36Sopenharmony_ci  unsigned long int u_tsize;	/* Text segment size (pages). */
6762306a36Sopenharmony_ci  unsigned long int u_dsize;	/* Data segment size (pages). */
6862306a36Sopenharmony_ci  unsigned long int u_ssize;	/* Stack segment size (pages). */
6962306a36Sopenharmony_ci  unsigned long start_code;     /* Starting virtual address of text. */
7062306a36Sopenharmony_ci  unsigned long start_stack;	/* Starting virtual address of stack area.
7162306a36Sopenharmony_ci				   This is actually the bottom of the stack,
7262306a36Sopenharmony_ci				   the top of the stack is always found in the
7362306a36Sopenharmony_ci				   esp register.  */
7462306a36Sopenharmony_ci  long int signal;		/* Signal that caused the core dump. */
7562306a36Sopenharmony_ci  int reserved;			/* No longer used */
7662306a36Sopenharmony_ci  unsigned long u_ar0;		/* Used by gdb to help find the values for */
7762306a36Sopenharmony_ci				/* the registers. */
7862306a36Sopenharmony_ci  struct user_m68kfp_struct* u_fpstate;	/* Math Co-processor pointer. */
7962306a36Sopenharmony_ci  unsigned long magic;		/* To uniquely identify a core file */
8062306a36Sopenharmony_ci  char u_comm[32];		/* User command that was responsible */
8162306a36Sopenharmony_ci};
8262306a36Sopenharmony_ci
8362306a36Sopenharmony_ci#endif
84