• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* SH specific core note handling.
2    Copyright (C) 2010 Red Hat, Inc.
3    This file is part of Red Hat elfutils.
4    Contributed Matt Fleming <matt@console-pimps.org>.
5 
6    Red Hat elfutils is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by the
8    Free Software Foundation; version 2 of the License.
9 
10    Red Hat elfutils is distributed in the hope that it will be useful, but
11    WITHOUT ANY WARRANTY; without even the implied warranty of
12    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13    General Public License for more details.
14 
15    You should have received a copy of the GNU General Public License along
16    with Red Hat elfutils; if not, write to the Free Software Foundation,
17    Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA.
18 
19    Red Hat elfutils is an included package of the Open Invention Network.
20    An included package of the Open Invention Network is a package for which
21    Open Invention Network licensees cross-license their patents.  No patent
22    license is granted, either expressly or impliedly, by designation as an
23    included package.  Should you wish to participate in the Open Invention
24    Network licensing program, please visit www.openinventionnetwork.com
25    <http://www.openinventionnetwork.com>.  */
26 
27 #ifdef HAVE_CONFIG_H
28 # include <config.h>
29 #endif
30 
31 #include <elf.h>
32 #include <inttypes.h>
33 #include <stddef.h>
34 #include <stdio.h>
35 #include <sys/time.h>
36 
37 #define BACKEND		sh_
38 #include "libebl_CPU.h"
39 
40 static const Ebl_Register_Location prstatus_regs[] =
41   {
42 #define GR(at, n, dwreg)						\
43     { .offset = at * 4, .regno = dwreg, .count = n, .bits = 32 }
44     GR (0, 16, 0),		/* r0-r15 */
45     GR (16, 1, 16),		/* pc */
46     GR (17, 1, 17),		/* pr */
47     GR (18, 1, 22),		/* sr */
48     GR (19, 1, 18),		/* gbr */
49     GR (20, 1, 20),		/* mach */
50     GR (21, 1, 21),		/* macl */
51     /*  22, 1,			   tra */
52 #undef GR
53   };
54 #define PRSTATUS_REGS_SIZE	(23 * 4)
55 
56 #define	ULONG			uint32_t
57 #define PID_T			int32_t
58 #define	UID_T			uint16_t
59 #define	GID_T			uint16_t
60 #define ALIGN_ULONG		4
61 #define ALIGN_PID_T		4
62 #define ALIGN_UID_T		2
63 #define ALIGN_GID_T		2
64 #define TYPE_ULONG		ELF_T_WORD
65 #define TYPE_PID_T		ELF_T_SWORD
66 #define TYPE_UID_T		ELF_T_HALF
67 #define TYPE_GID_T		ELF_T_HALF
68 
69 #define PRSTATUS_REGSET_ITEMS						      \
70   {									      \
71     .name = "tra", .type = ELF_T_ADDR, .format = 'x',			      \
72     .offset = offsetof (struct EBLHOOK(prstatus), pr_reg[22]),		      \
73     .group = "register"	       			  	       	 	      \
74   }
75 
76 static const Ebl_Register_Location fpregset_regs[] =
77   {
78     { .offset = 0, .regno = 25, .count = 16, .bits = 32 }, /* fr0-fr15 */
79     { .offset = 16, .regno = 87, .count = 16, .bits = 32 }, /* xf0-xf15 */
80     { .offset = 32, .regno = 24, .count = 1, .bits = 32 }, /* fpscr */
81     { .offset = 33, .regno = 23, .count = 1, .bits = 32 }  /* fpul */
82   };
83 #define FPREGSET_SIZE		(50 * 4)
84 
85 #include "linux-core-note.c"
86