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