1 /* x86-64 specific core note handling.
2 Copyright (C) 2005, 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/>. */
39 #define BACKEND x86_64_
40 #include "libebl_CPU.h"
43 static const Ebl_Register_Location prstatus_regs[] =
45 #define GR(at, n, dwreg) \
46 { .offset = at * 8, .regno = dwreg, .count = n, .bits = 64 }
47 #define SR(at, n, dwreg) \
48 { .offset = at * 8, .regno = dwreg, .count = n, .bits = 16, .pad = 6 }
50 GR (0, 1, 15), /* %r15 */
51 GR (1, 1, 14), /* %r14 */
52 GR (2, 1, 13), /* %r13 */
53 GR (3, 1, 12), /* %r12 */
54 GR (4, 1, 6), /* %rbp */
55 GR (5, 1, 3), /* %rbx */
56 GR (6, 1, 11), /* %r11 */
57 GR (7, 1, 10), /* %r10 */
58 GR (8, 1, 9), /* %r9 */
59 GR (9, 1, 8), /* %r8 */
60 GR (10,1, 0), /* %rax */
61 GR (11,1, 2), /* %rcx */
62 GR (12,1, 1), /* %rdx */
63 GR (13,2, 4), /* %rsi-%rdi */
65 GR (16,1, 16), /* %rip */
66 SR (17,1, 51), /* %cs */
67 GR (18,1, 49), /* %rFLAGS */
68 GR (19,1, 7), /* %rsp */
69 SR (20,1, 52), /* %ss */
70 GR (21,2, 58), /* %fs.base-%gs.base */
71 SR (23,1, 53), /* %ds */
72 SR (24,1, 50), /* %es */
73 SR (25,2, 54), /* %fs-%gs */
78 #define PRSTATUS_REGS_SIZE (27 * 8)
80 #define ULONG uint64_t
82 #define UID_T uint32_t
83 #define GID_T uint32_t
88 #define TYPE_ULONG ELF_T_XWORD
89 #define TYPE_PID_T ELF_T_SWORD
90 #define TYPE_UID_T ELF_T_SWORD
91 #define TYPE_GID_T ELF_T_SWORD
93 #define PRSTATUS_REGSET_ITEMS \
95 .name = "orig_rax", .type = ELF_T_SXWORD, .format = 'd', \
96 .offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + (8 * 15), \
100 static const Ebl_Register_Location fpregset_regs[] =
102 { .offset = 0, .regno = 65, .count = 2, .bits = 16 }, /* fcw-fsw */
103 { .offset = 24, .regno = 64, .count = 1, .bits = 32 }, /* mxcsr */
104 { .offset = 32, .regno = 33, .count = 8, .bits = 80, .pad = 6 }, /* stN */
105 { .offset = 32 + 128, .regno = 17, .count = 16, .bits = 128 }, /* xmm */
107 #define FPREGSET_SIZE 512
109 #define EXTRA_NOTES EXTRA_NOTES_IOPERM
111 #include "x86_corenote.c"
112 #include "linux-core-note.c"