1
0
Fork 0
mirror of https://github.com/tobast/libunwind-eh_elf.git synced 2024-12-28 22:03:42 +01:00
libunwind-eh_elf/src/_UPT_reg_offset.c
hp.com!davidm bbfe13cce0 (_UPT_reg_offset): Fix off-by-1 error.
(Logical change 1.81)
2003-04-21 23:14:14 +00:00

238 lines
12 KiB
C

/* libunwind - a platform-independent unwind library
Copyright (C) 2003 Hewlett-Packard Co
Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
This file is part of libunwind.
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
#ifdef HAVE_CONFIG_H
# include "config.h"
#endif
#include "_UPT_internal.h"
#ifdef HAVE_ASM_PTRACE_OFFSETS_H
# include <asm/ptrace_offsets.h>
#endif
int _UPT_reg_offset[UNW_REG_LAST + 1] =
{
#ifdef HAVE_ASM_PTRACE_OFFSETS_H
# ifndef PT_AR_CSD
# define PT_AR_CSD -1 /* this was introduced with rev 2.1 of ia64 */
# endif
[UNW_IA64_GR + 0] = -1, [UNW_IA64_GR + 1] = PT_R1,
[UNW_IA64_GR + 2] = PT_R2, [UNW_IA64_GR + 3] = PT_R3,
[UNW_IA64_GR + 4] = PT_R4, [UNW_IA64_GR + 5] = PT_R5,
[UNW_IA64_GR + 6] = PT_R6, [UNW_IA64_GR + 7] = PT_R7,
[UNW_IA64_GR + 8] = PT_R8, [UNW_IA64_GR + 9] = PT_R9,
[UNW_IA64_GR + 10] = PT_R10, [UNW_IA64_GR + 11] = PT_R11,
[UNW_IA64_GR + 12] = PT_R12, [UNW_IA64_GR + 13] = PT_R13,
[UNW_IA64_GR + 14] = PT_R14, [UNW_IA64_GR + 15] = PT_R15,
[UNW_IA64_GR + 16] = PT_R16, [UNW_IA64_GR + 17] = PT_R17,
[UNW_IA64_GR + 18] = PT_R18, [UNW_IA64_GR + 19] = PT_R19,
[UNW_IA64_GR + 20] = PT_R20, [UNW_IA64_GR + 21] = PT_R21,
[UNW_IA64_GR + 22] = PT_R22, [UNW_IA64_GR + 23] = PT_R23,
[UNW_IA64_GR + 24] = PT_R24, [UNW_IA64_GR + 25] = PT_R25,
[UNW_IA64_GR + 26] = PT_R26, [UNW_IA64_GR + 27] = PT_R27,
[UNW_IA64_GR + 28] = PT_R28, [UNW_IA64_GR + 29] = PT_R29,
[UNW_IA64_GR + 30] = PT_R30, [UNW_IA64_GR + 31] = PT_R31,
[UNW_IA64_NAT+ 0] = -1, [UNW_IA64_NAT+ 1] = PT_NAT_BITS,
[UNW_IA64_NAT+ 2] = PT_NAT_BITS, [UNW_IA64_NAT+ 3] = PT_NAT_BITS,
[UNW_IA64_NAT+ 4] = PT_NAT_BITS, [UNW_IA64_NAT+ 5] = PT_NAT_BITS,
[UNW_IA64_NAT+ 6] = PT_NAT_BITS, [UNW_IA64_NAT+ 7] = PT_NAT_BITS,
[UNW_IA64_NAT+ 8] = PT_NAT_BITS, [UNW_IA64_NAT+ 9] = PT_NAT_BITS,
[UNW_IA64_NAT+ 10] = PT_NAT_BITS, [UNW_IA64_NAT+ 11] = PT_NAT_BITS,
[UNW_IA64_NAT+ 12] = PT_NAT_BITS, [UNW_IA64_NAT+ 13] = PT_NAT_BITS,
[UNW_IA64_NAT+ 14] = PT_NAT_BITS, [UNW_IA64_NAT+ 15] = PT_NAT_BITS,
[UNW_IA64_NAT+ 16] = PT_NAT_BITS, [UNW_IA64_NAT+ 17] = PT_NAT_BITS,
[UNW_IA64_NAT+ 18] = PT_NAT_BITS, [UNW_IA64_NAT+ 19] = PT_NAT_BITS,
[UNW_IA64_NAT+ 20] = PT_NAT_BITS, [UNW_IA64_NAT+ 21] = PT_NAT_BITS,
[UNW_IA64_NAT+ 22] = PT_NAT_BITS, [UNW_IA64_NAT+ 23] = PT_NAT_BITS,
[UNW_IA64_NAT+ 24] = PT_NAT_BITS, [UNW_IA64_NAT+ 25] = PT_NAT_BITS,
[UNW_IA64_NAT+ 26] = PT_NAT_BITS, [UNW_IA64_NAT+ 27] = PT_NAT_BITS,
[UNW_IA64_NAT+ 28] = PT_NAT_BITS, [UNW_IA64_NAT+ 29] = PT_NAT_BITS,
[UNW_IA64_NAT+ 30] = PT_NAT_BITS, [UNW_IA64_NAT+ 31] = PT_NAT_BITS,
[UNW_IA64_FR + 0] = -1, [UNW_IA64_FR + 1] = -1,
[UNW_IA64_FR + 2] = PT_F2, [UNW_IA64_FR + 3] = PT_F3,
[UNW_IA64_FR + 4] = PT_F4, [UNW_IA64_FR + 5] = PT_F5,
[UNW_IA64_FR + 6] = PT_F6, [UNW_IA64_FR + 7] = PT_F7,
[UNW_IA64_FR + 8] = PT_F8, [UNW_IA64_FR + 9] = PT_F9,
[UNW_IA64_FR + 10] = PT_F10, [UNW_IA64_FR + 11] = PT_F11,
[UNW_IA64_FR + 12] = PT_F12, [UNW_IA64_FR + 13] = PT_F13,
[UNW_IA64_FR + 14] = PT_F14, [UNW_IA64_FR + 15] = PT_F15,
[UNW_IA64_FR + 16] = PT_F16, [UNW_IA64_FR + 17] = PT_F17,
[UNW_IA64_FR + 18] = PT_F18, [UNW_IA64_FR + 19] = PT_F19,
[UNW_IA64_FR + 20] = PT_F20, [UNW_IA64_FR + 21] = PT_F21,
[UNW_IA64_FR + 22] = PT_F22, [UNW_IA64_FR + 23] = PT_F23,
[UNW_IA64_FR + 24] = PT_F24, [UNW_IA64_FR + 25] = PT_F25,
[UNW_IA64_FR + 26] = PT_F26, [UNW_IA64_FR + 27] = PT_F27,
[UNW_IA64_FR + 28] = PT_F28, [UNW_IA64_FR + 29] = PT_F29,
[UNW_IA64_FR + 30] = PT_F30, [UNW_IA64_FR + 31] = PT_F31,
[UNW_IA64_FR + 32] = PT_F32, [UNW_IA64_FR + 33] = PT_F33,
[UNW_IA64_FR + 34] = PT_F34, [UNW_IA64_FR + 35] = PT_F35,
[UNW_IA64_FR + 36] = PT_F36, [UNW_IA64_FR + 37] = PT_F37,
[UNW_IA64_FR + 38] = PT_F38, [UNW_IA64_FR + 39] = PT_F39,
[UNW_IA64_FR + 40] = PT_F40, [UNW_IA64_FR + 41] = PT_F41,
[UNW_IA64_FR + 42] = PT_F42, [UNW_IA64_FR + 43] = PT_F43,
[UNW_IA64_FR + 44] = PT_F44, [UNW_IA64_FR + 45] = PT_F45,
[UNW_IA64_FR + 46] = PT_F46, [UNW_IA64_FR + 47] = PT_F47,
[UNW_IA64_FR + 48] = PT_F48, [UNW_IA64_FR + 49] = PT_F49,
[UNW_IA64_FR + 50] = PT_F50, [UNW_IA64_FR + 51] = PT_F51,
[UNW_IA64_FR + 52] = PT_F52, [UNW_IA64_FR + 53] = PT_F53,
[UNW_IA64_FR + 54] = PT_F54, [UNW_IA64_FR + 55] = PT_F55,
[UNW_IA64_FR + 56] = PT_F56, [UNW_IA64_FR + 57] = PT_F57,
[UNW_IA64_FR + 58] = PT_F58, [UNW_IA64_FR + 59] = PT_F59,
[UNW_IA64_FR + 60] = PT_F60, [UNW_IA64_FR + 61] = PT_F61,
[UNW_IA64_FR + 62] = PT_F62, [UNW_IA64_FR + 63] = PT_F63,
[UNW_IA64_FR + 64] = PT_F64, [UNW_IA64_FR + 65] = PT_F65,
[UNW_IA64_FR + 66] = PT_F66, [UNW_IA64_FR + 67] = PT_F67,
[UNW_IA64_FR + 68] = PT_F68, [UNW_IA64_FR + 69] = PT_F69,
[UNW_IA64_FR + 70] = PT_F70, [UNW_IA64_FR + 71] = PT_F71,
[UNW_IA64_FR + 72] = PT_F72, [UNW_IA64_FR + 73] = PT_F73,
[UNW_IA64_FR + 74] = PT_F74, [UNW_IA64_FR + 75] = PT_F75,
[UNW_IA64_FR + 76] = PT_F76, [UNW_IA64_FR + 77] = PT_F77,
[UNW_IA64_FR + 78] = PT_F78, [UNW_IA64_FR + 79] = PT_F79,
[UNW_IA64_FR + 80] = PT_F80, [UNW_IA64_FR + 81] = PT_F81,
[UNW_IA64_FR + 82] = PT_F82, [UNW_IA64_FR + 83] = PT_F83,
[UNW_IA64_FR + 84] = PT_F84, [UNW_IA64_FR + 85] = PT_F85,
[UNW_IA64_FR + 86] = PT_F86, [UNW_IA64_FR + 87] = PT_F87,
[UNW_IA64_FR + 88] = PT_F88, [UNW_IA64_FR + 89] = PT_F89,
[UNW_IA64_FR + 90] = PT_F90, [UNW_IA64_FR + 91] = PT_F91,
[UNW_IA64_FR + 92] = PT_F92, [UNW_IA64_FR + 93] = PT_F93,
[UNW_IA64_FR + 94] = PT_F94, [UNW_IA64_FR + 95] = PT_F95,
[UNW_IA64_FR + 96] = PT_F96, [UNW_IA64_FR + 97] = PT_F97,
[UNW_IA64_FR + 98] = PT_F98, [UNW_IA64_FR + 99] = PT_F99,
[UNW_IA64_FR +100] = PT_F100, [UNW_IA64_FR +101] = PT_F101,
[UNW_IA64_FR +102] = PT_F102, [UNW_IA64_FR +103] = PT_F103,
[UNW_IA64_FR +104] = PT_F104, [UNW_IA64_FR +105] = PT_F105,
[UNW_IA64_FR +106] = PT_F106, [UNW_IA64_FR +107] = PT_F107,
[UNW_IA64_FR +108] = PT_F108, [UNW_IA64_FR +109] = PT_F109,
[UNW_IA64_FR +110] = PT_F110, [UNW_IA64_FR +111] = PT_F111,
[UNW_IA64_FR +112] = PT_F112, [UNW_IA64_FR +113] = PT_F113,
[UNW_IA64_FR +114] = PT_F114, [UNW_IA64_FR +115] = PT_F115,
[UNW_IA64_FR +116] = PT_F116, [UNW_IA64_FR +117] = PT_F117,
[UNW_IA64_FR +118] = PT_F118, [UNW_IA64_FR +119] = PT_F119,
[UNW_IA64_FR +120] = PT_F120, [UNW_IA64_FR +121] = PT_F121,
[UNW_IA64_FR +122] = PT_F122, [UNW_IA64_FR +123] = PT_F123,
[UNW_IA64_FR +124] = PT_F124, [UNW_IA64_FR +125] = PT_F125,
[UNW_IA64_FR +126] = PT_F126, [UNW_IA64_FR +127] = PT_F127,
[UNW_IA64_AR + 0] = -1, [UNW_IA64_AR + 1] = -1,
[UNW_IA64_AR + 2] = -1, [UNW_IA64_AR + 3] = -1,
[UNW_IA64_AR + 4] = -1, [UNW_IA64_AR + 5] = -1,
[UNW_IA64_AR + 6] = -1, [UNW_IA64_AR + 7] = -1,
[UNW_IA64_AR + 8] = -1, [UNW_IA64_AR + 9] = -1,
[UNW_IA64_AR + 10] = -1, [UNW_IA64_AR + 11] = -1,
[UNW_IA64_AR + 12] = -1, [UNW_IA64_AR + 13] = -1,
[UNW_IA64_AR + 14] = -1, [UNW_IA64_AR + 15] = -1,
[UNW_IA64_AR + 16] = PT_AR_RSC, [UNW_IA64_AR + 17] = PT_AR_BSP,
[UNW_IA64_AR + 18] = PT_AR_BSPSTORE,[UNW_IA64_AR + 19] = PT_AR_RNAT,
[UNW_IA64_AR + 20] = -1, [UNW_IA64_AR + 21] = -1,
[UNW_IA64_AR + 22] = -1, [UNW_IA64_AR + 23] = -1,
[UNW_IA64_AR + 24] = -1, [UNW_IA64_AR + 25] = PT_AR_CSD,
[UNW_IA64_AR + 26] = -1, [UNW_IA64_AR + 27] = -1,
[UNW_IA64_AR + 28] = -1, [UNW_IA64_AR + 29] = -1,
[UNW_IA64_AR + 30] = -1, [UNW_IA64_AR + 31] = -1,
[UNW_IA64_AR + 32] = PT_AR_CCV, [UNW_IA64_AR + 33] = -1,
[UNW_IA64_AR + 34] = -1, [UNW_IA64_AR + 35] = -1,
[UNW_IA64_AR + 36] = PT_AR_UNAT, [UNW_IA64_AR + 37] = -1,
[UNW_IA64_AR + 38] = -1, [UNW_IA64_AR + 39] = -1,
[UNW_IA64_AR + 40] = PT_AR_FPSR, [UNW_IA64_AR + 41] = -1,
[UNW_IA64_AR + 42] = -1, [UNW_IA64_AR + 43] = -1,
[UNW_IA64_AR + 44] = -1, [UNW_IA64_AR + 45] = -1,
[UNW_IA64_AR + 46] = -1, [UNW_IA64_AR + 47] = -1,
[UNW_IA64_AR + 48] = -1, [UNW_IA64_AR + 49] = -1,
[UNW_IA64_AR + 50] = -1, [UNW_IA64_AR + 51] = -1,
[UNW_IA64_AR + 52] = -1, [UNW_IA64_AR + 53] = -1,
[UNW_IA64_AR + 54] = -1, [UNW_IA64_AR + 55] = -1,
[UNW_IA64_AR + 56] = -1, [UNW_IA64_AR + 57] = -1,
[UNW_IA64_AR + 58] = -1, [UNW_IA64_AR + 59] = -1,
[UNW_IA64_AR + 60] = -1, [UNW_IA64_AR + 61] = -1,
[UNW_IA64_AR + 62] = -1, [UNW_IA64_AR + 63] = -1,
[UNW_IA64_AR + 64] = PT_AR_PFS, [UNW_IA64_AR + 65] = PT_AR_LC,
[UNW_IA64_AR + 66] = PT_AR_EC, [UNW_IA64_AR + 67] = -1,
[UNW_IA64_AR + 68] = -1, [UNW_IA64_AR + 69] = -1,
[UNW_IA64_AR + 70] = -1, [UNW_IA64_AR + 71] = -1,
[UNW_IA64_AR + 72] = -1, [UNW_IA64_AR + 73] = -1,
[UNW_IA64_AR + 74] = -1, [UNW_IA64_AR + 75] = -1,
[UNW_IA64_AR + 76] = -1, [UNW_IA64_AR + 77] = -1,
[UNW_IA64_AR + 78] = -1, [UNW_IA64_AR + 79] = -1,
[UNW_IA64_AR + 80] = -1, [UNW_IA64_AR + 81] = -1,
[UNW_IA64_AR + 82] = -1, [UNW_IA64_AR + 83] = -1,
[UNW_IA64_AR + 84] = -1, [UNW_IA64_AR + 85] = -1,
[UNW_IA64_AR + 86] = -1, [UNW_IA64_AR + 87] = -1,
[UNW_IA64_AR + 88] = -1, [UNW_IA64_AR + 89] = -1,
[UNW_IA64_AR + 90] = -1, [UNW_IA64_AR + 91] = -1,
[UNW_IA64_AR + 92] = -1, [UNW_IA64_AR + 93] = -1,
[UNW_IA64_AR + 94] = -1, [UNW_IA64_AR + 95] = -1,
[UNW_IA64_AR + 96] = -1, [UNW_IA64_AR + 97] = -1,
[UNW_IA64_AR + 98] = -1, [UNW_IA64_AR + 99] = -1,
[UNW_IA64_AR +100] = -1, [UNW_IA64_AR +101] = -1,
[UNW_IA64_AR +102] = -1, [UNW_IA64_AR +103] = -1,
[UNW_IA64_AR +104] = -1, [UNW_IA64_AR +105] = -1,
[UNW_IA64_AR +106] = -1, [UNW_IA64_AR +107] = -1,
[UNW_IA64_AR +108] = -1, [UNW_IA64_AR +109] = -1,
[UNW_IA64_AR +110] = -1, [UNW_IA64_AR +111] = -1,
[UNW_IA64_AR +112] = -1, [UNW_IA64_AR +113] = -1,
[UNW_IA64_AR +114] = -1, [UNW_IA64_AR +115] = -1,
[UNW_IA64_AR +116] = -1, [UNW_IA64_AR +117] = -1,
[UNW_IA64_AR +118] = -1, [UNW_IA64_AR +119] = -1,
[UNW_IA64_AR +120] = -1, [UNW_IA64_AR +121] = -1,
[UNW_IA64_AR +122] = -1, [UNW_IA64_AR +123] = -1,
[UNW_IA64_AR +124] = -1, [UNW_IA64_AR +125] = -1,
[UNW_IA64_AR +126] = -1, [UNW_IA64_AR +127] = -1,
[UNW_IA64_BR + 0] = PT_B0, [UNW_IA64_BR + 1] = PT_B1,
[UNW_IA64_BR + 2] = PT_B2, [UNW_IA64_BR + 3] = PT_B3,
[UNW_IA64_BR + 4] = PT_B4, [UNW_IA64_BR + 5] = PT_B5,
[UNW_IA64_BR + 6] = PT_B6, [UNW_IA64_BR + 7] = PT_B7,
[UNW_IA64_PR] = PT_PR,
[UNW_IA64_CFM] = PT_CFM,
[UNW_IA64_IP] = PT_CR_IIP
#elif defined(HAVE_TTRACE)
# warning No support for ttrace() yet.
#elif defined(UNW_TARGET_X86)
[UNW_X86_EAX] = 0x18,
[UNW_X86_EBX] = 0x00,
[UNW_X86_ECX] = 0x04,
[UNW_X86_EDX] = 0x08,
[UNW_X86_ESI] = 0x0c,
[UNW_X86_EDI] = 0x10,
[UNW_X86_EBP] = 0x14,
[UNW_X86_EIP] = 0x30,
[UNW_X86_ESP] = 0x3c
/* CS = 0x34, */
/* DS = 0x1c, */
/* ES = 0x20, */
/* FS = 0x24, */
/* GS = 0x28, */
/* ORIG_EAX = 0x2c, */
/* EFLAGS = 0x38, */
/* SS = 0x40 */
#else
# error Fix me.
#endif
};