1 /* Copyright (C) 2000-2022 Free Software Foundation, Inc.
2    This file is part of the GNU C Library.
3 
4    The GNU C Library is free software; you can redistribute it and/or
5    modify it under the terms of the GNU Lesser General Public
6    License as published by the Free Software Foundation; either
7    version 2.1 of the License, or (at your option) any later version.
8 
9    The GNU C Library is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12    Lesser General Public License for more details.
13 
14    You should have received a copy of the GNU Lesser General Public
15    License along with the GNU C Library; if not, see
16    <https://www.gnu.org/licenses/>.  */
17 
18 #ifndef _SYS_USER_H
19 #define _SYS_USER_H	1
20 
21 /* The whole purpose of this file is for GDB and GDB only.  Don't read
22    too much into it.  Don't use it for anything other than GDB unless
23    you know what you are doing.  */
24 
25 struct _user_psw_struct
26 {
27   unsigned long mask;
28   unsigned long addr;
29 };
30 
31 struct _user_fpregs_struct
32 {
33   unsigned int fpc;
34   double fprs[16];
35 };
36 
37 struct _user_per_struct
38 {
39   unsigned long control_regs[3];
40   unsigned single_step       : 1;
41   unsigned instruction_fetch : 1;
42   unsigned                   : 30;
43   unsigned long starting_addr;
44   unsigned long ending_addr;
45   unsigned short perc_atmid;
46   unsigned long address;
47   unsigned char access_id;
48 };
49 
50 struct _user_regs_struct
51 {
52   struct _user_psw_struct psw;		/* Program status word.  */
53   unsigned long gprs[16];		/* General purpose registers.  */
54   unsigned int  acrs[16];		/* Access registers.  */
55   unsigned long orig_gpr2;		/* Original gpr2.  */
56   struct _user_fpregs_struct fp_regs;	/* Floating point registers.  */
57   struct _user_per_struct per_info;	/* Hardware tracing registers.  */
58   unsigned long ieee_instruction_pointer;	/* Always 0.  */
59 };
60 
61 struct user {
62   struct _user_regs_struct regs;	/* User registers.  */
63   unsigned long int u_tsize;		/* Text segment size (pages).  */
64   unsigned long int u_dsize;		/* Data segment size (pages).  */
65   unsigned long int u_ssize;		/* Stack segment size (pages).  */
66   unsigned long start_code;		/* Starting address of text.  */
67   unsigned long start_stack;		/* Starting address of stack area.  */
68   long int signal;			/* Signal causing the core dump.  */
69   struct _user_regs_struct *u_ar0;	/* Help gdb find registers.  */
70   unsigned long magic;			/* Identifies a core file.  */
71   char u_comm[32];			/* User command naem.  */
72 };
73 
74 #define PAGE_SHIFT		12
75 #define PAGE_SIZE		(1UL << PAGE_SHIFT)
76 #define PAGE_MASK		(~(PAGE_SIZE-1))
77 #define NBPG			PAGE_SIZE
78 #define UPAGES			1
79 #define HOST_TEXT_START_ADDR	(u.start_code)
80 #define HOST_STACK_END_ADDR	(u.start_stack + u.u_ssize * NBPG)
81 
82 #endif	/* _SYS_USER_H */
83