1/* x86-64 specific core note handling. 2 Copyright (C) 2005, 2007, 2008 Red Hat, Inc. 3 This file is part of Red Hat elfutils. 4 5 Red Hat elfutils is free software; you can redistribute it and/or modify 6 it under the terms of the GNU General Public License as published by the 7 Free Software Foundation; version 2 of the License. 8 9 Red Hat elfutils is distributed in the hope that it will be useful, but 10 WITHOUT ANY WARRANTY; without even the implied warranty of 11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 General Public License for more details. 13 14 You should have received a copy of the GNU General Public License along 15 with Red Hat elfutils; if not, write to the Free Software Foundation, 16 Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA. 17 18 Red Hat elfutils is an included package of the Open Invention Network. 19 An included package of the Open Invention Network is a package for which 20 Open Invention Network licensees cross-license their patents. No patent 21 license is granted, either expressly or impliedly, by designation as an 22 included package. Should you wish to participate in the Open Invention 23 Network licensing program, please visit www.openinventionnetwork.com 24 <http://www.openinventionnetwork.com>. */ 25 26#ifdef HAVE_CONFIG_H 27# include <config.h> 28#endif 29 30#include <elf.h> 31#include <inttypes.h> 32#include <stddef.h> 33#include <stdio.h> 34#include <sys/time.h> 35 36#define BACKEND x86_64_ 37#include "libebl_CPU.h" 38 39 40static const Ebl_Register_Location prstatus_regs[] = 41 { 42#define GR(at, n, dwreg) \ 43 { .offset = at * 8, .regno = dwreg, .count = n, .bits = 64 } 44#define SR(at, n, dwreg) \ 45 { .offset = at * 8, .regno = dwreg, .count = n, .bits = 16, .pad = 6 } 46 47 GR (0, 1, 15), /* %r15 */ 48 GR (1, 1, 14), /* %r14 */ 49 GR (2, 1, 13), /* %r13 */ 50 GR (3, 1, 12), /* %r12 */ 51 GR (4, 1, 6), /* %rbp */ 52 GR (5, 1, 3), /* %rbx */ 53 GR (6, 1, 11), /* %r11 */ 54 GR (7, 1, 10), /* %r10 */ 55 GR (8, 1, 9), /* %r9 */ 56 GR (9, 1, 8), /* %r8 */ 57 GR (10,1, 0), /* %rax */ 58 GR (11,1, 2), /* %rcx */ 59 GR (12,1, 1), /* %rdx */ 60 GR (13,2, 4), /* %rsi-%rdi */ 61 /* 15,1, orig_rax */ 62 GR (16,1, 16), /* %rip */ 63 SR (17,1, 51), /* %cs */ 64 GR (18,1, 49), /* %rFLAGS */ 65 GR (19,1, 7), /* %rsp */ 66 SR (20,1, 52), /* %ss */ 67 GR (21,2, 58), /* %fs.base-%gs.base */ 68 SR (23,1, 53), /* %ds */ 69 SR (24,1, 50), /* %es */ 70 SR (25,2, 54), /* %fs-%gs */ 71 72#undef GR 73#undef SR 74 }; 75#define PRSTATUS_REGS_SIZE (27 * 8) 76 77#define ULONG uint64_t 78#define PID_T int32_t 79#define UID_T uint32_t 80#define GID_T uint32_t 81#define ALIGN_ULONG 8 82#define ALIGN_PID_T 4 83#define ALIGN_UID_T 4 84#define ALIGN_GID_T 4 85#define TYPE_ULONG ELF_T_XWORD 86#define TYPE_PID_T ELF_T_SWORD 87#define TYPE_UID_T ELF_T_SWORD 88#define TYPE_GID_T ELF_T_SWORD 89 90#define PRSTATUS_REGSET_ITEMS \ 91 { \ 92 .name = "orig_rax", .type = ELF_T_SXWORD, .format = 'd', \ 93 .offset = offsetof (struct EBLHOOK(prstatus), pr_reg) + (8 * 15), \ 94 .group = "register" \ 95 } 96 97static const Ebl_Register_Location fpregset_regs[] = 98 { 99 { .offset = 0, .regno = 65, .count = 2, .bits = 16 }, /* fcw-fsw */ 100 { .offset = 24, .regno = 64, .count = 1, .bits = 32 }, /* mxcsr */ 101 { .offset = 32, .regno = 33, .count = 8, .bits = 80, .pad = 6 }, /* stN */ 102 { .offset = 32 + 128, .regno = 17, .count = 16, .bits = 128 }, /* xmm */ 103 }; 104#define FPREGSET_SIZE 512 105 106#define EXTRA_NOTES EXTRA_NOTES_IOPERM 107 108#include "x86_corenote.c" 109#include "linux-core-note.c" 110