From 21881c551d0b67a6d1dd19f1826282958d0234fb Mon Sep 17 00:00:00 2001 From: Martin Storsjo Date: Tue, 2 Jan 2018 20:10:54 +0000 Subject: [PPC64] Port to ppc64le - initial version Initial working version of libunwind for PowerPC 64. Tested on little-endian ppc64 host only. Based on the existing PowerPC 32 code. It supports: - context save/restore (unw_getcontext, unw_init_local, unw_resume) - read/write from/to saved registers - backtrace (unw_step) Patch by Leandro Lupori! Differential Revision: https://reviews.llvm.org/D41386 git-svn-id: https://llvm.org/svn/llvm-project/libunwind/trunk@321667 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/__libunwind_config.h | 11 ++++- include/libunwind.h | 114 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 123 insertions(+), 2 deletions(-) (limited to 'include') diff --git a/include/__libunwind_config.h b/include/__libunwind_config.h index 69a4996..1c254d6 100644 --- a/include/__libunwind_config.h +++ b/include/__libunwind_config.h @@ -18,6 +18,7 @@ #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86 8 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64 32 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC 112 +#define _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 110 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM64 95 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_ARM 287 #define _LIBUNWIND_HIGHEST_DWARF_REGISTER_OR1K 31 @@ -39,6 +40,11 @@ # define _LIBUNWIND_CURSOR_SIZE 33 # endif # define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_X86_64 +# elif defined(__powerpc64__) +# define _LIBUNWIND_TARGET_PPC64 1 +# define _LIBUNWIND_CONTEXT_SIZE 136 +# define _LIBUNWIND_CURSOR_SIZE 148 +# define _LIBUNWIND_HIGHEST_DWARF_REGISTER _LIBUNWIND_HIGHEST_DWARF_REGISTER_PPC64 # elif defined(__ppc__) # define _LIBUNWIND_TARGET_PPC 1 # define _LIBUNWIND_CONTEXT_SIZE 117 @@ -84,13 +90,14 @@ # define _LIBUNWIND_TARGET_I386 # define _LIBUNWIND_TARGET_X86_64 1 # define _LIBUNWIND_TARGET_PPC 1 +# define _LIBUNWIND_TARGET_PPC64 1 # define _LIBUNWIND_TARGET_AARCH64 1 # define _LIBUNWIND_TARGET_ARM 1 # define _LIBUNWIND_TARGET_OR1K 1 # define _LIBUNWIND_TARGET_MIPS_O32 1 # define _LIBUNWIND_TARGET_MIPS_N64 1 -# define _LIBUNWIND_CONTEXT_SIZE 128 -# define _LIBUNWIND_CURSOR_SIZE 140 +# define _LIBUNWIND_CONTEXT_SIZE 136 +# define _LIBUNWIND_CURSOR_SIZE 148 # define _LIBUNWIND_HIGHEST_DWARF_REGISTER 287 #endif // _LIBUNWIND_IS_NATIVE_ONLY diff --git a/include/libunwind.h b/include/libunwind.h index 9011d55..29cf62e 100644 --- a/include/libunwind.h +++ b/include/libunwind.h @@ -325,6 +325,120 @@ enum { UNW_PPC_SPEFSCR = 112 }; +// 64-bit ppc register numbers +enum { + UNW_PPC64_R0 = 0, + UNW_PPC64_R1 = 1, + UNW_PPC64_R2 = 2, + UNW_PPC64_R3 = 3, + UNW_PPC64_R4 = 4, + UNW_PPC64_R5 = 5, + UNW_PPC64_R6 = 6, + UNW_PPC64_R7 = 7, + UNW_PPC64_R8 = 8, + UNW_PPC64_R9 = 9, + UNW_PPC64_R10 = 10, + UNW_PPC64_R11 = 11, + UNW_PPC64_R12 = 12, + UNW_PPC64_R13 = 13, + UNW_PPC64_R14 = 14, + UNW_PPC64_R15 = 15, + UNW_PPC64_R16 = 16, + UNW_PPC64_R17 = 17, + UNW_PPC64_R18 = 18, + UNW_PPC64_R19 = 19, + UNW_PPC64_R20 = 20, + UNW_PPC64_R21 = 21, + UNW_PPC64_R22 = 22, + UNW_PPC64_R23 = 23, + UNW_PPC64_R24 = 24, + UNW_PPC64_R25 = 25, + UNW_PPC64_R26 = 26, + UNW_PPC64_R27 = 27, + UNW_PPC64_R28 = 28, + UNW_PPC64_R29 = 29, + UNW_PPC64_R30 = 30, + UNW_PPC64_R31 = 31, + UNW_PPC64_F0 = 32, + UNW_PPC64_F1 = 33, + UNW_PPC64_F2 = 34, + UNW_PPC64_F3 = 35, + UNW_PPC64_F4 = 36, + UNW_PPC64_F5 = 37, + UNW_PPC64_F6 = 38, + UNW_PPC64_F7 = 39, + UNW_PPC64_F8 = 40, + UNW_PPC64_F9 = 41, + UNW_PPC64_F10 = 42, + UNW_PPC64_F11 = 43, + UNW_PPC64_F12 = 44, + UNW_PPC64_F13 = 45, + UNW_PPC64_F14 = 46, + UNW_PPC64_F15 = 47, + UNW_PPC64_F16 = 48, + UNW_PPC64_F17 = 49, + UNW_PPC64_F18 = 50, + UNW_PPC64_F19 = 51, + UNW_PPC64_F20 = 52, + UNW_PPC64_F21 = 53, + UNW_PPC64_F22 = 54, + UNW_PPC64_F23 = 55, + UNW_PPC64_F24 = 56, + UNW_PPC64_F25 = 57, + UNW_PPC64_F26 = 58, + UNW_PPC64_F27 = 59, + UNW_PPC64_F28 = 60, + UNW_PPC64_F29 = 61, + UNW_PPC64_F30 = 62, + UNW_PPC64_F31 = 63, + UNW_PPC64_LR = 64, + UNW_PPC64_CTR = 65, + UNW_PPC64_CR0 = 66, + UNW_PPC64_CR1 = 67, + UNW_PPC64_CR2 = 68, + UNW_PPC64_CR3 = 69, + UNW_PPC64_CR4 = 70, + UNW_PPC64_CR5 = 71, + UNW_PPC64_CR6 = 72, + UNW_PPC64_CR7 = 73, + UNW_PPC64_XER = 74, + UNW_PPC64_V0 = 75, + UNW_PPC64_V1 = 76, + UNW_PPC64_V2 = 77, + UNW_PPC64_V3 = 78, + UNW_PPC64_V4 = 79, + UNW_PPC64_V5 = 80, + UNW_PPC64_V6 = 81, + UNW_PPC64_V7 = 82, + UNW_PPC64_V8 = 83, + UNW_PPC64_V9 = 84, + UNW_PPC64_V10 = 85, + UNW_PPC64_V11 = 86, + UNW_PPC64_V12 = 87, + UNW_PPC64_V13 = 88, + UNW_PPC64_V14 = 89, + UNW_PPC64_V15 = 90, + UNW_PPC64_V16 = 91, + UNW_PPC64_V17 = 92, + UNW_PPC64_V18 = 93, + UNW_PPC64_V19 = 94, + UNW_PPC64_V20 = 95, + UNW_PPC64_V21 = 96, + UNW_PPC64_V22 = 97, + UNW_PPC64_V23 = 98, + UNW_PPC64_V24 = 99, + UNW_PPC64_V25 = 100, + UNW_PPC64_V26 = 101, + UNW_PPC64_V27 = 102, + UNW_PPC64_V28 = 103, + UNW_PPC64_V29 = 104, + UNW_PPC64_V30 = 105, + UNW_PPC64_V31 = 106, + UNW_PPC64_VRSAVE = 107, + UNW_PPC64_VSCR = 108, + UNW_PPC64_FPSCR = 109 +}; + // 64-bit ARM64 registers enum { UNW_ARM64_X0 = 0, -- cgit v1.2.3