1 /* PowerPC specific core note handling.
2 Copyright (C) 2007, 2008 Red Hat, Inc.
3 This file is part of elfutils.
5 This file is free software; you can redistribute it and/or modify
6 it under the terms of either
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
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
18 or both in parallel, as here.
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.
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/>. */
44 # define BACKEND ppc64_
46 #include "libebl_CPU.h"
48 static const Ebl_Register_Location prstatus_regs[] =
50 #define GR(at, n, dwreg) \
51 { .offset = at * BITS/8, .regno = dwreg, .count = n, .bits = BITS }
53 GR (0, 32, 0), /* r0-r31 */
55 GR (33, 1, 66), /* msr */
56 /* 34, 1, orig_gpr3 */
57 GR (35, 1, 109), /* ctr */
58 GR (36, 1, 108), /* lr */
59 GR (37, 1, 101), /* xer */
60 GR (38, 1, 64), /* cr */
61 GR (39, 1, 100), /* mq */
63 GR (41, 1, 119), /* dar */
64 GR (42, 1, 118), /* dsisr */
68 #define PRSTATUS_REGS_SIZE (BITS / 8 * 48)
70 static const Ebl_Register_Location fpregset_regs[] =
72 { .offset = 0, .regno = 32, .count = 32, .bits = 64 }, /* f0-f31 */
73 { .offset = 32 * 8 + 4, .regno = 65, .count = 1, .bits = 32 } /* fpscr */
75 #define FPREGSET_SIZE (33 * 8)
77 static const Ebl_Register_Location altivec_regs[] =
80 { .offset = 0, .regno = 1124, .count = 32, .bits = 128 },
81 /* vscr XXX 67 is an unofficial assignment */
82 { .offset = 32 * 16, .regno = 67, .count = 1, .bits = 32, .pad = 12 },
84 { .offset = 33 * 16, .regno = 356, .count = 1, .bits = 32, .pad = 12 }
87 static const Ebl_Register_Location spe_regs[] =
90 { .offset = 0, .regno = ???, .count = 32, .bits = 32 },
92 { .offset = 32 * 4, .regno = ???, .count = 1, .bits = 64 }, */
94 { .offset = 34 * 4, .regno = 612, .count = 1, .bits = 32 }
98 EXTRA_REGSET (NT_PPC_VMX, 34 * 16, altivec_regs) \
99 EXTRA_REGSET (NT_PPC_SPE, 35 * 4, spe_regs)
102 # define ULONG uint32_t
103 # define ALIGN_ULONG 4
104 # define TYPE_ULONG ELF_T_WORD
105 # define TYPE_LONG ELF_T_SWORD
107 # define ULONG uint64_t
108 # define ALIGN_ULONG 8
109 # define TYPE_ULONG ELF_T_XWORD
110 # define TYPE_LONG ELF_T_SXWORD
112 #define PID_T int32_t
113 #define UID_T uint32_t
114 #define GID_T uint32_t
115 #define ALIGN_PID_T 4
116 #define ALIGN_UID_T 4
117 #define ALIGN_GID_T 4
118 #define TYPE_PID_T ELF_T_SWORD
119 #define TYPE_UID_T ELF_T_WORD
120 #define TYPE_GID_T ELF_T_WORD
122 #define PRSTATUS_REGSET_ITEMS \
124 .name = "nip", .type = ELF_T_ADDR, .format = 'x', \
125 .offset = offsetof (struct EBLHOOK(prstatus), pr_reg[32]), \
126 .group = "register" \
129 .name = "orig_gpr3", .type = TYPE_LONG, .format = 'd', \
130 .offset = offsetof (struct EBLHOOK(prstatus), pr_reg[34]), \
131 .group = "register" \
134 #include "linux-core-note.c"