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