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