11da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#ifndef _M68K_USER_H
21da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define _M68K_USER_H
31da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
41da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* Core file format: The core file is written in such a way that gdb
51da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   can understand it and provide useful information to the user (under
61da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   linux we use the 'trad-core' bfd).  There are quite a number of
71da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   obstacles to being able to view the contents of the floating point
81da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   registers, and until these are solved you will not be able to view the
91da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   contents of them.  Actually, you can read in the core file and look at
101da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   the contents of the user struct to find out what the floating point
111da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   registers contain.
121da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   The actual file contents are as follows:
131da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   UPAGE: 1 page consisting of a user struct that tells gdb what is present
141da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   in the file.  Directly after this is a copy of the task_struct, which
151da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   is currently not used by gdb, but it may come in useful at some point.
161da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   All of the registers are stored as part of the upage.  The upage should
171da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   always be only one page.
181da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   DATA: The data area is stored.  We use current->end_text to
191da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   current->brk to pick up all of the user variables, plus any memory
201da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   that may have been malloced.  No attempt is made to determine if a page
211da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   is demand-zero or if a page is totally unused, we just cover the entire
221da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   range.  All of the addresses are rounded in such a way that an integral
231da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   number of pages is written.
241da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   STACK: We need the stack information in order to get a meaningful
251da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   backtrace.  We need to write the data from (esp) to
261da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   current->start_stack, so we round each of these off in order to be able
271da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   to write an integer number of pages.
281da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   The minimum core file size is 3 pages, or 12288 bytes.
291da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds*/
301da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
311da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct user_m68kfp_struct {
321da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned long  fpregs[8*3];	/* fp0-fp7 registers */
331da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	unsigned long  fpcntl[3];	/* fp control regs */
341da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
351da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
361da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* This is the old layout of "struct pt_regs" as of Linux 1.x, and
371da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   is still the layout used by user (the new pt_regs doesn't have
381da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   all registers). */
391da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct user_regs_struct {
401da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	long d1,d2,d3,d4,d5,d6,d7;
411da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	long a0,a1,a2,a3,a4,a5,a6;
421da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	long d0;
431da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	long usp;
441da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	long orig_d0;
451da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	short stkadj;
461da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	short sr;
471da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	long pc;
481da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	short fmtvec;
491da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds	short __fill;
501da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
511da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
521da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
531da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* When the kernel dumps core, it starts by dumping the user struct -
541da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   this will be used by gdb to figure out where the data and stack segments
551da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   are within the file, and what virtual addresses to use. */
561da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvaldsstruct user{
571da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* We start with the registers, to mimic the way that "memory" is returned
581da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds   from the ptrace(3,...) function.  */
591da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  struct user_regs_struct regs;	/* Where the registers are actually stored */
601da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* ptrace does not yet supply these.  Someday.... */
611da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  int u_fpvalid;		/* True if math co-processor being used. */
621da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds                                /* for this mess. Not yet used. */
631da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  struct user_m68kfp_struct m68kfp; /* Math Co-processor registers. */
641da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds/* The rest of this junk is to help gdb figure out what goes where */
651da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  unsigned long int u_tsize;	/* Text segment size (pages). */
661da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  unsigned long int u_dsize;	/* Data segment size (pages). */
671da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  unsigned long int u_ssize;	/* Stack segment size (pages). */
681da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  unsigned long start_code;     /* Starting virtual address of text. */
691da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  unsigned long start_stack;	/* Starting virtual address of stack area.
701da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds				   This is actually the bottom of the stack,
711da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds				   the top of the stack is always found in the
721da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds				   esp register.  */
731da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  long int signal;		/* Signal that caused the core dump. */
741da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  int reserved;			/* No longer used */
756e16d89bcd668a95eb22add24c02d80890232b66H. Peter Anvin  unsigned long u_ar0;		/* Used by gdb to help find the values for */
761da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds				/* the registers. */
771da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  struct user_m68kfp_struct* u_fpstate;	/* Math Co-processor pointer. */
781da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  unsigned long magic;		/* To uniquely identify a core file */
791da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds  char u_comm[32];		/* User command that was responsible */
801da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds};
815e7c4ea83efa9d6269bcbf17611f83aeef71c096Roman Zippel#define NBPG 4096
821da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define UPAGES 1
831da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define HOST_TEXT_START_ADDR (u.start_code)
841da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
851da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds
861da177e4c3f41524e886b7f1b8a0c1fc7321cacLinus Torvalds#endif
87