Projects
openEuler:22.03:LTS:LoongArch
libunwind
_service:tar_scm_kernel_repo:libunwind-1.5.0-sw...
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File _service:tar_scm_kernel_repo:libunwind-1.5.0-sw.patch of Package libunwind
diff -Nuar libunwind-1.5.0.org/Makefile.am libunwind-1.5.0.sw/Makefile.am --- libunwind-1.5.0.org/Makefile.am 2022-03-24 07:05:05.103873440 +0000 +++ libunwind-1.5.0.sw/Makefile.am 2022-03-16 09:18:38.000000000 +0000 @@ -23,6 +23,9 @@ if ARCH_MIPS include_HEADERS += include/libunwind-mips.h endif +if ARCH_SW_64 +include_HEADERS += include/libunwind-sw_64.h +endif if ARCH_TILEGX include_HEADERS += include/libunwind-tilegx.h endif @@ -75,6 +78,8 @@ include/tdep-hppa/jmpbuf.h include/tdep-hppa/dwarf-config.h \ include/tdep-mips/libunwind_i.h \ include/tdep-mips/jmpbuf.h include/tdep-mips/dwarf-config.h \ + include/tdep-sw_64/libunwind_i.h \ + include/tdep-sw_64/jmpbuf.h include/tdep-sw_64/dwarf-config.h \ include/tdep-tilegx/libunwind_i.h \ include/tdep-tilegx/jmpbuf.h include/tdep-tilegx/dwarf-config.h \ include/tdep-x86/libunwind_i.h \ diff -Nuar libunwind-1.5.0.org/Makefile.in libunwind-1.5.0.sw/Makefile.in --- libunwind-1.5.0.org/Makefile.in 2022-03-24 07:05:05.023873440 +0000 +++ libunwind-1.5.0.sw/Makefile.in 2022-03-24 06:51:54.000000000 +0000 @@ -106,6 +106,7 @@ @REMOTE_ONLY_FALSE@am__append_15 = include/libunwind.h include/unwind.h @CONFIG_TESTS_TRUE@am__append_16 = tests @CONFIG_DOCS_TRUE@am__append_17 = doc +@ARCH_SW_64_TRUE@am__append_18 = include/libunwind-sw_64.h subdir = . ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ @@ -159,6 +160,7 @@ include/libunwind-x86.h include/libunwind-x86_64.h \ include/libunwind-ppc32.h include/libunwind-ppc64.h \ include/libunwind-sh.h include/libunwind-s390x.h \ + include/libunwind-sw_64.h \ include/libunwind.h include/unwind.h am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ @@ -427,6 +429,7 @@ $(am__append_5) $(am__append_6) $(am__append_7) \ $(am__append_8) $(am__append_9) $(am__append_10) \ $(am__append_11) $(am__append_12) $(am__append_13) \ + $(am__append_18) \ $(am__append_14) $(am__append_15) nodist_include_HEADERS = include/libunwind-common.h SUBDIRS = src $(am__append_16) $(am__append_17) @@ -456,6 +459,8 @@ include/tdep-ppc64/jmpbuf.h include/tdep-ppc64/libunwind_i.h \ include/tdep-sh/dwarf-config.h \ include/tdep-sh/jmpbuf.h include/tdep-sh/libunwind_i.h \ + include/tdep-sw_64/dwarf-config.h \ + include/tdep-sw_64/jmpbuf.h include/tdep-sw_64/libunwind_i.h \ include/tdep-s390x/dwarf-config.h \ include/tdep-s390x/jmpbuf.h include/tdep-s390x/libunwind_i.h \ include/tdep/libunwind_i.h \ diff -Nuar libunwind-1.5.0.org/config/config.guess libunwind-1.5.0.sw/config/config.guess --- libunwind-1.5.0.org/config/config.guess 2022-03-24 07:05:05.113873440 +0000 +++ libunwind-1.5.0.sw/config/config.guess 2022-03-16 09:18:38.000000000 +0000 @@ -275,6 +275,36 @@ mips:OSF1:*.*) echo mips-dec-osf1 exit ;; + sw_64:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + SW_64_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The sw_64 \(.*\) processor.*$/\1/p' | head -n 1` + case "$SW_64_CPU_TYPE" in + "SW6A (1621)") + UNAME_MACHINE=sw_64sw6a ;; + "SW6B (3231)") + UNAME_MACHINE=sw_64sw6b ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo "$UNAME_MACHINE"-dec-osf"`echo "$UNAME_RELEASE" | sed -e 's/^[PVTX]//' | tr ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz`" + # Reset EXIT trap before exiting to avoid spurious non-zero exit code. + exitcode=$? + trap '' 0 + exit $exitcode ;; alpha:OSF1:*:*) case $UNAME_RELEASE in *4.0) @@ -904,6 +934,16 @@ UNAME_MACHINE=aarch64_be echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" exit ;; + sw_64:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + SW6A) UNAME_MACHINE=sw_64sw6a ;; + SW6B) UNAME_MACHINE=sw_64sw6b ;; + sw) UNAME_MACHINE=sw_64 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC=gnulibc1 ; fi + echo "$UNAME_MACHINE"-unknown-linux-"$LIBC" + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -1397,6 +1437,7 @@ UNAME_MACHINE=`(uname -p) 2>/dev/null` case "$UNAME_MACHINE" in A*) echo alpha-dec-vms ; exit ;; + S*) echo sw_64-dec-vms ; exit ;; I*) echo ia64-dec-vms ; exit ;; V*) echo vax-dec-vms ; exit ;; esac ;; diff -Nuar libunwind-1.5.0.org/config/config.sub libunwind-1.5.0.sw/config/config.sub --- libunwind-1.5.0.org/config/config.sub 2022-03-24 07:05:05.113873440 +0000 +++ libunwind-1.5.0.sw/config/config.sub 2022-03-16 09:18:38.000000000 +0000 @@ -308,6 +308,7 @@ | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ | spu \ + | sw_64 | sw_64sw6a | sw_64sw6b \ | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \ | ubicom32 \ | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \ @@ -435,6 +436,7 @@ | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ | sparclite-* \ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx*-* \ + | sw_64-* | sw_64sw6a-* | sw_64sw6b-* \ | tahoe-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tile*-* \ diff -Nuar libunwind-1.5.0.org/configure libunwind-1.5.0.sw/configure --- libunwind-1.5.0.org/configure 2022-03-24 07:05:05.033873440 +0000 +++ libunwind-1.5.0.sw/configure 2022-03-17 03:41:30.000000000 +0000 @@ -697,6 +697,8 @@ ARCH_X86_64_TRUE ARCH_X86_FALSE ARCH_X86_TRUE +ARCH_SW_64_FALSE +ARCH_SW_64_TRUE ARCH_MIPS_FALSE ARCH_MIPS_TRUE ARCH_HPPA_FALSE @@ -17449,6 +17451,8 @@ build_arch=hppa ;; #( mips*) : build_arch=mips ;; #( + sw_64*) : + build_arch=sw_64 ;; #( powerpc*) : build_arch=ppc$ppc_bits ;; #( sh*) : @@ -17473,6 +17477,8 @@ host_arch=hppa ;; #( mips*) : host_arch=mips ;; #( + sw_64*) : + host_arch=sw_64 ;; #( powerpc*) : host_arch=ppc$ppc_bits ;; #( sh*) : @@ -17497,6 +17503,8 @@ target_arch=hppa ;; #( mips*) : target_arch=mips ;; #( + sw_64*) : + target_arch=sw_64 ;; #( powerpc*) : target_arch=ppc$ppc_bits ;; #( sh*) : @@ -17705,6 +17713,14 @@ ARCH_MIPS_FALSE= fi + if test x$target_arch = xsw_64; then + ARCH_SW_64_TRUE= + ARCH_SW_64_FALSE='#' +else + ARCH_SW_64_TRUE='#' + ARCH_SW_64_FALSE= +fi + if test x$target_arch = xx86; then ARCH_X86_TRUE= ARCH_X86_FALSE='#' @@ -17809,6 +17825,8 @@ $as_echo "32" >&6; };; (aarch64|ia64|ppc64|x86_64|s390x|tilegx) use_elf64=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: 64" >&5 $as_echo "64" >&6; };; +(sw_64) use_elf64=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: 64" >&5 +$as_echo "64" >&6; };; (mips) use_elfxx=yes; { $as_echo "$as_me:${as_lineno-$LINENO}: result: xx" >&5 $as_echo "xx" >&6; };; *) as_fn_error $? "Unknown ELF target: ${target_arch}" "$LINENO" 5 @@ -17901,6 +17919,7 @@ x86*) enable_cxx_exceptions=no;; aarch64*) enable_cxx_exceptions=no;; arm*) enable_cxx_exceptions=no;; + sw_64*) enable_cxx_exceptions=no;; mips*) enable_cxx_exceptions=no;; tile*) enable_cxx_exceptions=no;; *) enable_cxx_exceptions=yes;; @@ -18744,6 +18763,10 @@ as_fn_error $? "conditional \"ARCH_MIPS\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi +if test -z "${ARCH_SW_64_TRUE}" && test -z "${ARCH_SW_64_FALSE}"; then + as_fn_error $? "conditional \"ARCH_SW_64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi if test -z "${ARCH_X86_TRUE}" && test -z "${ARCH_X86_FALSE}"; then as_fn_error $? "conditional \"ARCH_X86\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 diff -Nuar libunwind-1.5.0.org/configure.ac libunwind-1.5.0.sw/configure.ac --- libunwind-1.5.0.org/configure.ac 2022-03-24 07:05:05.023873440 +0000 +++ libunwind-1.5.0.sw/configure.ac 2022-03-24 06:45:49.000000000 +0000 @@ -94,6 +94,7 @@ [i?86],[$2=x86], [hppa*],[$2=hppa], [mips*],[$2=mips], + [sw_64],[$2=sw_64], [powerpc*],[$2=ppc$ppc_bits], [sh*],[$2=sh], [amd64],[$2=x86_64], @@ -173,6 +174,7 @@ AM_CONDITIONAL(ARCH_IA64, test x$target_arch = xia64) AM_CONDITIONAL(ARCH_HPPA, test x$target_arch = xhppa) AM_CONDITIONAL(ARCH_MIPS, test x$target_arch = xmips) +AM_CONDITIONAL(ARCH_SW_64, test x$target_arch = xsw_64) AM_CONDITIONAL(ARCH_X86, test x$target_arch = xx86) AM_CONDITIONAL(ARCH_X86_64, test x$target_arch = xx86_64) AM_CONDITIONAL(ARCH_PPC32, test x$target_arch = xppc32) @@ -190,6 +192,7 @@ case "${target_arch}" in (arm|hppa|ppc32|x86|sh) use_elf32=yes; AC_MSG_RESULT([32]);; (aarch64|ia64|ppc64|x86_64|s390x|tilegx) use_elf64=yes; AC_MSG_RESULT([64]);; +(sw_64) use_elf64=yes; AC_MSG_RESULT([64]);; (mips) use_elfxx=yes; AC_MSG_RESULT([xx]);; *) AC_MSG_ERROR([Unknown ELF target: ${target_arch}]) esac @@ -240,6 +243,7 @@ x86*) enable_cxx_exceptions=no;; aarch64*) enable_cxx_exceptions=no;; arm*) enable_cxx_exceptions=no;; + sw_64*) enable_cxx_exceptions=no;; mips*) enable_cxx_exceptions=no;; tile*) enable_cxx_exceptions=no;; *) enable_cxx_exceptions=yes;; diff -Nuar libunwind-1.5.0.org/include/libunwind-sw_64.h libunwind-1.5.0.sw/include/libunwind-sw_64.h --- libunwind-1.5.0.org/include/libunwind-sw_64.h 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/include/libunwind-sw_64.h 2022-03-16 09:18:38.000000000 +0000 @@ -0,0 +1,178 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#ifndef LIBUNWIND_H +#define LIBUNWIND_H + +#if defined(__cplusplus) || defined(c_plusplus) +extern "C" { +#endif + +#include <inttypes.h> +#include <sys/ucontext.h> + +#ifdef sw_64 +# undef sw_64 +#endif + +#define UNW_TARGET sw_64 +#define UNW_TARGET_SW_64 1 + +#define _U_TDEP_QP_TRUE 0 /* see libunwind-dynamic.h */ + +/* This needs to be big enough to accommodate "struct cursor", while + leaving some slack for future expansion. Changing this value will + require recompiling all users of this library. Stack allocation is + relatively cheap and unwind-state copying is relatively rare, so we + want to err on making it rather too big than too small. */ + +/* FIXME for SW_64. Too big? What do other things use for similar tasks? */ +#define UNW_TDEP_CURSOR_LEN 4096 + +/* The size of a "word" varies on SW_64. This type is used for memory + addresses and register values, which are 32-bit wide for O32 and N32 + ABIs, and 64-bit wide for N64 ABI. */ +typedef uint64_t unw_word_t; +typedef int32_t unw_sword_t; + +/* FIXME: SW_64 ABIs. */ +typedef long double unw_tdep_fpreg_t; + +typedef enum + { + UNW_SW_64_R0, + UNW_SW_64_R1, + UNW_SW_64_R2, + UNW_SW_64_R3, + UNW_SW_64_R4, + UNW_SW_64_R5, + UNW_SW_64_R6, + UNW_SW_64_R7, + UNW_SW_64_R8, + UNW_SW_64_R9, + UNW_SW_64_R10, + UNW_SW_64_R11, + UNW_SW_64_R12, + UNW_SW_64_R13, + UNW_SW_64_R14, + UNW_SW_64_R15, + UNW_SW_64_R16, + UNW_SW_64_R17, + UNW_SW_64_R18, + UNW_SW_64_R19, + UNW_SW_64_R20, + UNW_SW_64_R21, + UNW_SW_64_R22, + UNW_SW_64_R23, + UNW_SW_64_R24, + UNW_SW_64_R25, + UNW_SW_64_R26, + UNW_SW_64_R27, + UNW_SW_64_R28, + UNW_SW_64_R29, + UNW_SW_64_R30, + UNW_SW_64_R31, + UNW_SW_64_F0, + UNW_SW_64_F1, + UNW_SW_64_F2, + UNW_SW_64_F3, + UNW_SW_64_F4, + UNW_SW_64_F5, + UNW_SW_64_F6, + UNW_SW_64_F7, + UNW_SW_64_F8, + UNW_SW_64_F9, + UNW_SW_64_F10, + UNW_SW_64_F11, + UNW_SW_64_F12, + UNW_SW_64_F13, + UNW_SW_64_F14, + UNW_SW_64_F15, + UNW_SW_64_F16, + UNW_SW_64_F17, + UNW_SW_64_F18, + UNW_SW_64_F19, + UNW_SW_64_F20, + UNW_SW_64_F21, + UNW_SW_64_F22, + UNW_SW_64_F23, + UNW_SW_64_F24, + UNW_SW_64_F25, + UNW_SW_64_F26, + UNW_SW_64_F27, + UNW_SW_64_F28, + UNW_SW_64_F29, + UNW_SW_64_F30, + UNW_SW_64_FPCR, + UNW_SW_64_PC = 64, + + UNW_TDEP_LAST_REG = UNW_SW_64_PC, + UNW_TDEP_IP = UNW_SW_64_PC, + UNW_TDEP_SP = UNW_SW_64_R30, + UNW_TDEP_EH = UNW_SW_64_R0 + } +sw_64_regnum_t; + +typedef enum + { + UNW_SW_64_ABI_N64 + } +sw_64_abi_t; + +#define UNW_TDEP_NUM_EH_REGS 2 /* FIXME for SW_64. */ + +typedef struct unw_tdep_save_loc + { + /* Additional target-dependent info on a save location. */ + } +unw_tdep_save_loc_t; + +/* On x86, we can directly use ucontext_t as the unwind context. FIXME for + SW_64. */ +typedef ucontext_t unw_tdep_context_t; + +#include "libunwind-dynamic.h" + +typedef struct + { + /* no sw_64-specific auxiliary proc-info */ + } +unw_tdep_proc_info_t; + +#include "libunwind-common.h" + +/* There is no getcontext() on SW_64. Use a stub version which only saves GP + registers. FIXME: Not ideal, may not be sufficient for all libunwind + use cases. */ +#define unw_tdep_getcontext UNW_ARCH_OBJ(getcontext) +extern int unw_tdep_getcontext (ucontext_t *uc); + +#define unw_tdep_is_fpreg UNW_ARCH_OBJ(is_fpreg) +extern int unw_tdep_is_fpreg (int); + +#if defined(__cplusplus) || defined(c_plusplus) +} +#endif + +#endif /* LIBUNWIND_H */ diff -Nuar libunwind-1.5.0.org/include/libunwind.h libunwind-1.5.0.sw/include/libunwind.h --- libunwind-1.5.0.org/include/libunwind.h 2022-03-24 07:05:05.103873440 +0000 +++ libunwind-1.5.0.sw/include/libunwind.h 2022-03-16 09:18:38.000000000 +0000 @@ -13,6 +13,8 @@ # include "libunwind-ia64.h" #elif defined __mips__ # include "libunwind-mips.h" +#elif defined __sw_64__ +# include "libunwind-sw_64.h" #elif defined __powerpc__ && !defined __powerpc64__ # include "libunwind-ppc32.h" #elif defined __powerpc64__ diff -Nuar libunwind-1.5.0.org/include/libunwind.h.in libunwind-1.5.0.sw/include/libunwind.h.in --- libunwind-1.5.0.org/include/libunwind.h.in 2022-03-24 07:05:05.103873440 +0000 +++ libunwind-1.5.0.sw/include/libunwind.h.in 2022-03-16 09:18:38.000000000 +0000 @@ -13,6 +13,8 @@ # include "libunwind-ia64.h" #elif defined __mips__ # include "libunwind-mips.h" +#elif defined __sw_64__ +# include "libunwind-sw_64.h" #elif defined __powerpc__ && !defined __powerpc64__ # include "libunwind-ppc32.h" #elif defined __powerpc64__ diff -Nuar libunwind-1.5.0.org/include/tdep/dwarf-config.h libunwind-1.5.0.sw/include/tdep/dwarf-config.h --- libunwind-1.5.0.org/include/tdep/dwarf-config.h 2022-03-24 07:05:05.103873440 +0000 +++ libunwind-1.5.0.sw/include/tdep/dwarf-config.h 2022-03-16 09:18:38.000000000 +0000 @@ -11,6 +11,8 @@ # include "tdep-ia64/dwarf-config.h" #elif defined __mips__ # include "tdep-mips/dwarf-config.h" +#elif defined __sw_64__ +# include "tdep-sw_64/dwarf-config.h" #elif defined __powerpc__ && !defined __powerpc64__ # include "tdep-ppc32/dwarf-config.h" #elif defined __powerpc64__ diff -Nuar libunwind-1.5.0.org/include/tdep/jmpbuf.h libunwind-1.5.0.sw/include/tdep/jmpbuf.h --- libunwind-1.5.0.org/include/tdep/jmpbuf.h 2022-03-24 07:05:05.103873440 +0000 +++ libunwind-1.5.0.sw/include/tdep/jmpbuf.h 2022-03-16 09:18:38.000000000 +0000 @@ -13,6 +13,8 @@ # include "tdep-ia64/jmpbuf.h" #elif defined __mips__ # include "tdep-mips/jmpbuf.h" +#elif defined __sw_64__ +# include "tdep-sw_64/jmpbuf.h" #elif defined __powerpc__ && !defined __powerpc64__ # include "tdep-ppc32/jmpbuf.h" #elif defined __powerpc64__ diff -Nuar libunwind-1.5.0.org/include/tdep/libunwind_i.h libunwind-1.5.0.sw/include/tdep/libunwind_i.h --- libunwind-1.5.0.org/include/tdep/libunwind_i.h 2022-03-24 07:05:05.103873440 +0000 +++ libunwind-1.5.0.sw/include/tdep/libunwind_i.h 2022-03-16 09:18:38.000000000 +0000 @@ -13,6 +13,8 @@ # include "tdep-ia64/libunwind_i.h" #elif defined __mips__ # include "tdep-mips/libunwind_i.h" +#elif defined __sw_64__ +# include "tdep-sw_64/libunwind_i.h" #elif defined __powerpc__ && !defined __powerpc64__ # include "tdep-ppc32/libunwind_i.h" #elif defined __powerpc64__ diff -Nuar libunwind-1.5.0.org/include/tdep/libunwind_i.h.in libunwind-1.5.0.sw/include/tdep/libunwind_i.h.in --- libunwind-1.5.0.org/include/tdep/libunwind_i.h.in 2022-03-24 07:05:05.103873440 +0000 +++ libunwind-1.5.0.sw/include/tdep/libunwind_i.h.in 2022-03-16 09:18:38.000000000 +0000 @@ -13,6 +13,8 @@ # include "tdep-ia64/libunwind_i.h" #elif defined __mips__ # include "tdep-mips/libunwind_i.h" +#elif defined __sw_64__ +# include "tdep-sw_64/libunwind_i.h" #elif defined __powerpc__ && !defined __powerpc64__ # include "tdep-ppc32/libunwind_i.h" #elif defined __powerpc64__ diff -Nuar libunwind-1.5.0.org/include/tdep-sw_64/dwarf-config.h libunwind-1.5.0.sw/include/tdep-sw_64/dwarf-config.h --- libunwind-1.5.0.org/include/tdep-sw_64/dwarf-config.h 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/include/tdep-sw_64/dwarf-config.h 2022-03-16 09:18:38.000000000 +0000 @@ -0,0 +1,51 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.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. */ + +#ifndef dwarf_config_h +#define dwarf_config_h + +/* This is FIRST_PSEUDO_REGISTER in GCC, since DWARF_FRAME_REGISTERS is not + explicitly defined. */ +#define DWARF_NUM_PRESERVED_REGS 65 + +#define dwarf_to_unw_regnum(reg) (((reg) < 32) ? (reg) : 0) + +/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */ +#define dwarf_is_big_endian(addr_space) ((addr_space)->big_endian) + +/* Convert a pointer to a dwarf_cursor structure to a pointer to + unw_cursor_t. */ +#define dwarf_to_cursor(c) ((unw_cursor_t *) (c)) + +typedef struct dwarf_loc + { + unw_word_t val; +#ifndef UNW_LOCAL_ONLY + unw_word_t type; /* see DWARF_LOC_TYPE_* macros. */ +#endif + } +dwarf_loc_t; + +#endif /* dwarf_config_h */ diff -Nuar libunwind-1.5.0.org/include/tdep-sw_64/jmpbuf.h libunwind-1.5.0.sw/include/tdep-sw_64/jmpbuf.h --- libunwind-1.5.0.org/include/tdep-sw_64/jmpbuf.h 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/include/tdep-sw_64/jmpbuf.h 2022-03-16 09:18:38.000000000 +0000 @@ -0,0 +1,32 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +/* Use glibc's jump-buffer indices; NPTL peeks at SP: */ + +/* FIXME for MIPS! */ + +#define JB_SP 4 +#define JB_RP 5 +#define JB_MASK_SAVED 6 +#define JB_MASK 7 diff -Nuar libunwind-1.5.0.org/include/tdep-sw_64/libunwind_i.h libunwind-1.5.0.sw/include/tdep-sw_64/libunwind_i.h --- libunwind-1.5.0.org/include/tdep-sw_64/libunwind_i.h 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/include/tdep-sw_64/libunwind_i.h 2022-03-16 09:18:38.000000000 +0000 @@ -0,0 +1,349 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#ifndef SW_64_LIBUNWIND_I_H +#define SW_64_LIBUNWIND_I_H + +/* Target-dependent definitions that are internal to libunwind but need + to be shared with target-independent code. */ + +#include <stdlib.h> +#include <libunwind.h> +# include "elf64.h" +#include "mempool.h" +#include "dwarf.h" + +typedef struct + { + /* no sw_64-specific fast trace */ + uint64_t virtual_address; + int64_t frame_type : 2; /* unw_tdep_frame_type_t classification */ + int64_t last_frame : 1; /* non-zero if last frame in chain */ + int64_t cfa_reg_rsp : 1; /* cfa dwarf base register is rsp vs. rbp */ + int64_t cfa_reg_offset : 30; /* cfa is at this offset from base register value */ + int64_t rbp_cfa_offset : 15; /* rbp saved at this offset from cfa (-1 = not saved) */ + int64_t rsp_cfa_offset : 15; /* rsp saved at this offset from cfa (-1 = not saved) */ + } +unw_tdep_frame_t; + +struct unw_addr_space + { + struct unw_accessors acc; + + int big_endian; + sw_64_abi_t abi; + unsigned int addr_size; + + unw_caching_policy_t caching_policy; +#ifdef HAVE_ATOMIC_OPS_H + AO_t cache_generation; +#else + uint32_t cache_generation; +#endif + unw_word_t dyn_generation; /* see dyn-common.h */ + unw_word_t dyn_info_list_addr; /* (cached) dyn_info_list_addr */ + struct dwarf_rs_cache global_cache; + struct unw_debug_frame_list *debug_frames; +}; + +#define tdep_big_endian(as) ((as)->big_endian) + +struct cursor + { + struct dwarf_cursor dwarf; /* must be first */ + unw_tdep_frame_t frame_info; /* quick tracing assist info */ + enum + { + SW_SCF_NONE, /* no signal frame */ + SW_SCF_LINUX_SIGFRAME, /* non-RT signal frame */ + SW_SCF_LINUX_RT_SIGFRAME, /* RT signal frame */ + } + sigcontext_format; + + unw_word_t sigcontext_addr; + unw_word_t sigcontext_sp; + unw_word_t sigcontext_pc; + unw_word_t ucontext_addr; + }; + +#define DWARF_GET_LOC(l) ((l).val) + +#ifndef UNW_REMOTE_ONLY +# if _SW_64_SIM == _ABIN32 +typedef long long sw_64_reg_t; +# else +typedef long sw_64_reg_t; +# endif +#endif + +#ifdef UNW_LOCAL_ONLY +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) (DWARF_GET_LOC (l) == 0) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r) }) +# define DWARF_IS_REG_LOC(l) 0 +# define DWARF_REG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) (DWARF_LOC((unw_word_t) (intptr_t) \ + tdep_uc_addr((c)->as_arg, (r)), 0)) + +/* FIXME: Implement these for the SW_64 FPU. */ +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(unw_fpreg_t *) (intptr_t) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(unw_fpreg_t *) (intptr_t) DWARF_GET_LOC (loc) = val; + return 0; +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *val = *(sw_64_reg_t *) (intptr_t) DWARF_GET_LOC (loc); + return 0; +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (!DWARF_GET_LOC (loc)) + return -1; + *(sw_64_reg_t *) (intptr_t) DWARF_GET_LOC (loc) = val; + return 0; +} + +#else /* !UNW_LOCAL_ONLY */ +# define DWARF_LOC_TYPE_FP (1 << 0) +# define DWARF_LOC_TYPE_REG (1 << 1) +# define DWARF_NULL_LOC DWARF_LOC (0, 0) +# define DWARF_IS_NULL_LOC(l) \ + ({ dwarf_loc_t _l = (l); _l.val == 0 && _l.type == 0; }) +# define DWARF_LOC(r, t) ((dwarf_loc_t) { .val = (r), .type = (t) }) +# define DWARF_IS_REG_LOC(l) (((l).type & DWARF_LOC_TYPE_REG) != 0) +# define DWARF_IS_FP_LOC(l) (((l).type & DWARF_LOC_TYPE_FP) != 0) +# define DWARF_REG_LOC(c,r) DWARF_LOC((r), DWARF_LOC_TYPE_REG) +# define DWARF_MEM_LOC(c,m) DWARF_LOC ((m), 0) +# define DWARF_FPREG_LOC(c,r) DWARF_LOC((r), (DWARF_LOC_TYPE_REG \ + | DWARF_LOC_TYPE_FP)) + +static inline int +read_s32 (struct dwarf_cursor *c, unw_word_t addr, unw_word_t *val) +{ + int offset = addr & 4; + int ret; + unw_word_t memval; + + ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg); + if (ret < 0) + return ret; + + if ((offset != 0) == tdep_big_endian (c->as)) + *val = (int32_t) memval; + else + *val = (int32_t) (memval >> 32); + + return 0; +} + +static inline int +write_s32 (struct dwarf_cursor *c, unw_word_t addr, const unw_word_t *val) +{ + int offset = addr & 4; + int ret; + unw_word_t memval; + + ret = (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 0, c->as_arg); + if (ret < 0) + return ret; + + if ((offset != 0) == tdep_big_endian (c->as)) + memval = (memval & ~0xffffffffLL) | (uint32_t) *val; + else + memval = (memval & 0xffffffffLL) | (uint32_t) (*val << 32); + + return (*c->as->acc.access_mem) (c->as, addr - offset, &memval, 1, c->as_arg); +} + +/* FIXME: Implement these for the SW_64 FPU. */ +static inline int +dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val) +{ + char *valp = (char *) &val; + unw_word_t addr; +// int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + val, 0, c->as_arg); + + addr = DWARF_GET_LOC (loc); +#if 0 + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 0, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, 0, + c->as_arg); +#else + return (*c->as->acc.access_mem) (c->as, addr,(unw_word_t *) valp,0,c->as_arg); +#endif +} + +static inline int +dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val) +{ + char *valp = (char *) &val; + unw_word_t addr; +// int ret; + + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_fpreg) (c->as, DWARF_GET_LOC (loc), + &val, 1, c->as_arg); + + addr = DWARF_GET_LOC (loc); +#if 0 + if ((ret = (*c->as->acc.access_mem) (c->as, addr + 0, (unw_word_t *) valp, + 1, c->as_arg)) < 0) + return ret; + + return (*c->as->acc.access_mem) (c->as, addr + 4, (unw_word_t *) valp + 1, + 1, c->as_arg); +#else + return (*c->as->acc.access_mem) (c->as, addr, (unw_word_t *) valp,1, c->as_arg); +#endif +} + +static inline int +dwarf_get (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t *val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), val, + 0, c->as_arg); +} + +static inline int +dwarf_put (struct dwarf_cursor *c, dwarf_loc_t loc, unw_word_t val) +{ + if (DWARF_IS_NULL_LOC (loc)) + return -UNW_EBADREG; + + /* If a code-generator were to save a value of type unw_word_t in a + floating-point register, we would have to support this case. I + suppose it could happen with MMX registers, but does it really + happen? */ + assert (!DWARF_IS_FP_LOC (loc)); + + if (DWARF_IS_REG_LOC (loc)) + return (*c->as->acc.access_reg) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); + else + return (*c->as->acc.access_mem) (c->as, DWARF_GET_LOC (loc), &val, + 1, c->as_arg); +} + +#endif /* !UNW_LOCAL_ONLY */ + +#define tdep_getcontext_trace unw_getcontext +#define tdep_init_done UNW_OBJ(init_done) +#define tdep_init UNW_OBJ(init) +/* Platforms that support UNW_INFO_FORMAT_TABLE need to define + tdep_search_unwind_table. */ +#define tdep_search_unwind_table dwarf_search_unwind_table +#define tdep_find_unwind_table dwarf_find_unwind_table +#define tdep_uc_addr UNW_ARCH_OBJ(uc_addr) +#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image) +#define tdep_get_exe_image_path UNW_ARCH_OBJ(get_exe_image_path) +#define tdep_access_reg UNW_OBJ(access_reg) +#define tdep_access_fpreg UNW_OBJ(access_fpreg) +#define tdep_fetch_frame(c,ip,n) do {} while(0) +#define tdep_cache_frame(c) 0 +#define tdep_reuse_frame(c,frame) do {} while(0) +#define tdep_stash_frame(c,rs) do {} while(0) +#define tdep_trace(cur,addr,n) (-UNW_ENOINFO) + +#ifdef UNW_LOCAL_ONLY +# define tdep_find_proc_info(c,ip,n) \ + dwarf_find_proc_info((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + dwarf_put_unwind_info((as), (pi), (arg)) +#else +# define tdep_find_proc_info(c,ip,n) \ + (*(c)->as->acc.find_proc_info)((c)->as, (ip), &(c)->pi, (n), \ + (c)->as_arg) +# define tdep_put_unwind_info(as,pi,arg) \ + (*(as)->acc.put_unwind_info)((as), (pi), (arg)) +#endif + +#define tdep_get_as(c) ((c)->dwarf.as) +#define tdep_get_as_arg(c) ((c)->dwarf.as_arg) +#define tdep_get_ip(c) ((c)->dwarf.ip) + +extern int tdep_init_done; + +extern void tdep_init (void); +extern int tdep_search_unwind_table (unw_addr_space_t as, unw_word_t ip, + unw_dyn_info_t *di, unw_proc_info_t *pi, + int need_unwind_info, void *arg); +extern void *tdep_uc_addr (ucontext_t *uc, int reg); +extern int tdep_get_elf_image (struct elf_image *ei, pid_t pid, unw_word_t ip, + unsigned long *segbase, unsigned long *mapoff, + char *path, size_t pathlen); +extern void tdep_get_exe_image_path (char *path); +extern int tdep_access_reg (struct cursor *c, unw_regnum_t reg, + unw_word_t *valp, int write); +extern int tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, + unw_fpreg_t *valp, int write); + +#endif /* SW_64_LIBUNWIND_I_H */ diff -Nuar libunwind-1.5.0.org/src/Makefile.am libunwind-1.5.0.sw/src/Makefile.am --- libunwind-1.5.0.org/src/Makefile.am 2022-03-24 07:05:05.053873440 +0000 +++ libunwind-1.5.0.sw/src/Makefile.am 2022-03-18 08:47:00.000000000 +0000 @@ -337,6 +337,27 @@ tilegx/Gis_signal_frame.c tilegx/Gregs.c tilegx/Gresume.c tilegx/Gstep.c +# The list of files that go info libunwind and libunwind-sw_64: +noinst_HEADERS += sw_64/init.h sw_64/offsets.h sw_64/unwind_i.h +libunwind_la_SOURCES_sw_64_common = $(libunwind_la_SOURCES_common) \ + sw_64/is_fpreg.c sw_64/regname.c + +# The list of files that go into libunwind: +libunwind_la_SOURCES_sw_64 = $(libunwind_la_SOURCES_sw_64_common) \ + $(libunwind_la_SOURCES_local) \ + sw_64/getcontext.S \ + sw_64/Lapply_reg_state.c sw_64/Lreg_states_iterate.c \ + sw_64/Lcreate_addr_space.c sw_64/Lget_proc_info.c sw_64/Lget_save_loc.c \ + sw_64/Lglobal.c sw_64/Linit.c sw_64/Linit_local.c sw_64/Linit_remote.c \ + sw_64/Lis_signal_frame.c sw_64/Lregs.c sw_64/Lresume.c sw_64/Lstep.c + +libunwind_sw_64_la_SOURCES_sw_64 = $(libunwind_la_SOURCES_sw_64_common) \ + $(libunwind_la_SOURCES_generic) \ + sw_64/Gapply_reg_state.c sw_64/Greg_states_iterate.c \ + sw_64/Gcreate_addr_space.c sw_64/Gget_proc_info.c sw_64/Gget_save_loc.c \ + sw_64/Gglobal.c sw_64/Ginit.c sw_64/Ginit_local.c sw_64/Ginit_remote.c \ + sw_64/Gis_signal_frame.c sw_64/Gregs.c sw_64/Gresume.c sw_64/Gstep.c + # The list of files that go both into libunwind and libunwind-x86: noinst_HEADERS += x86/init.h x86/offsets.h x86/unwind_i.h libunwind_la_SOURCES_x86_common = $(libunwind_la_SOURCES_common) \ @@ -599,6 +620,18 @@ libunwind_setjmp_la_SOURCES += ia64/setjmp.S ia64/sigsetjmp.S \ ia64/longjmp.S ia64/siglongjmp.S else +if ARCH_SW_64 + lib_LTLIBRARIES += libunwind-sw_64.la + libunwind_la_SOURCES = $(libunwind_la_SOURCES_sw_64) + libunwind_sw_64_la_SOURCES = $(libunwind_sw_64_la_SOURCES_sw_64) + libunwind_sw_64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) + libunwind_sw_64_la_LIBADD = libunwind-dwarf-generic.la + libunwind_sw_64_la_LIBADD += libunwind-elfxx.la +if !REMOTE_ONLY + libunwind_sw_64_la_LIBADD += libunwind.la -lc +endif + libunwind_setjmp_la_SOURCES += sw_64/siglongjmp.S +else if ARCH_HPPA lib_LTLIBRARIES += libunwind-hppa.la libunwind_la_SOURCES = $(libunwind_la_SOURCES_hppa) @@ -717,6 +750,7 @@ endif # ARCH_HPPA endif # ARCH_IA64 endif # ARCH_ARM +endif # ARCH_SW_64 endif # ARCH_AARCH64 # libunwind-setjmp depends on libunwind-$(arch). Therefore must be added @@ -759,6 +793,7 @@ $(libunwind_ia64_la_SOURCES_ia64) \ $(libunwind_mips_la_SOURCES_mips) \ $(libunwind_sh_la_SOURCES_sh) \ + $(libunwind_sw_64_la_SOURCES_sw_64) \ $(libunwind_x86_la_SOURCES_x86) \ $(libunwind_x86_64_la_SOURCES_x86_64) diff -Nuar libunwind-1.5.0.org/src/Makefile.in libunwind-1.5.0.sw/src/Makefile.in --- libunwind-1.5.0.org/src/Makefile.in 2022-03-24 07:05:05.043873440 +0000 +++ libunwind-1.5.0.sw/src/Makefile.in 2022-03-24 06:58:14.000000000 +0000 @@ -145,6 +145,14 @@ # libunwind-setjmp depends on libunwind-$(arch). Therefore must be added # at the end. @BUILD_SETJMP_TRUE@am__append_48 = libunwind-setjmp.la + +@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SW_64_TRUE@@ARCH_S390X_FALSE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_49 = libunwind-sw_64.la +@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SW_64_TRUE@@ARCH_S390X_FALSE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@@REMOTE_ONLY_FALSE@am__append_50 = libunwind.la -lc +@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SW_64_TRUE@@ARCH_S390X_FALSE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@am__append_51 = sw_64/siglongjmp.S + +# libunwind-setjmp depends on libunwind-$(arch). Therefore must be added +# at the end. +@BUILD_SETJMP_TRUE@am__append_52 = libunwind-setjmp.la subdir = src ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ @@ -576,6 +584,7 @@ ia64/siglongjmp.S hppa/siglongjmp.S mips/siglongjmp.S \ tilegx/siglongjmp.S x86/longjmp.S x86/siglongjmp.S \ x86_64/longjmp.S x86_64/siglongjmp.S ppc/longjmp.S \ + sw_64/siglongjmp.S \ ppc/siglongjmp.S sh/siglongjmp.S @ARCH_AARCH64_TRUE@am__objects_29 = aarch64/siglongjmp.lo @ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@am__objects_30 = arm/siglongjmp.lo @@ -776,6 +785,11 @@ sh/Lcreate_addr_space.c sh/Lget_proc_info.c sh/Lget_save_loc.c \ sh/Lglobal.c sh/Linit.c sh/Linit_local.c sh/Linit_remote.c \ sh/Lis_signal_frame.c sh/Lregs.c sh/Lresume.c sh/Lstep.c \ + sw_64/is_fpreg.c sw_64/regname.c \ + sw_64/getcontext.S sw_64/Lapply_reg_state.c sw_64/Lreg_states_iterate.c \ + sw_64/Lcreate_addr_space.c sw_64/Lget_proc_info.c sw_64/Lget_save_loc.c \ + sw_64/Lglobal.c sw_64/Linit.c sw_64/Linit_local.c sw_64/Linit_remote.c \ + sw_64/Lis_signal_frame.c sw_64/Lregs.c sw_64/Lresume.c sw_64/Lstep.c \ ppc64/is_fpreg.c ppc64/regname.c ppc64/get_func_addr.c \ ppc/Lget_proc_info.c ppc/Lget_save_loc.c ppc/Linit_local.c \ ppc/Linit_remote.c ppc/Lis_signal_frame.c \ @@ -973,6 +987,57 @@ @ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@am_libunwind_la_OBJECTS = \ @ARCH_AARCH64_FALSE@@ARCH_ARM_TRUE@ $(am__objects_70) @ARCH_AARCH64_TRUE@am_libunwind_la_OBJECTS = $(am__objects_71) + +@ARCH_SW_64_TRUE@am__objects_72 = sw_64/siglongjmp.lo +am_libunwind_setjmp_la_OBJECTS = setjmp/longjmp.lo \ + setjmp/siglongjmp.lo $(am__objects_72) +libunwind_setjmp_la_OBJECTS = $(am_libunwind_setjmp_la_OBJECTS) +libunwind_setjmp_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libunwind_setjmp_la_LDFLAGS) \ + $(LDFLAGS) -o $@ +@BUILD_SETJMP_TRUE@am_libunwind_setjmp_la_rpath = -rpath $(libdir) +@ARCH_SW_64_TRUE@@REMOTE_ONLY_FALSE@am__DEPENDENCIES_14 = libunwind.la +@ARCH_SW_64_TRUE@libunwind_sw_64_la_DEPENDENCIES = libunwind-dwarf-generic.la \ +@ARCH_SW_64_TRUE@ libunwind-elfxx.la \ +@ARCH_SW_64_TRUE@ $(am__DEPENDENCIES_14) +am__libunwind_sw_64_la_SOURCES_DIST = os-freebsd.c os-hpux.c os-linux.c \ + os-qnx.c os-solaris.c mi/init.c mi/flush_cache.c mi/mempool.c \ + mi/strerror.c sw_64/is_fpreg.c sw_64/regname.c mi/Gdyn-extract.c \ + mi/Gdyn-remote.c mi/Gfind_dynamic_proc_info.c \ + mi/Gget_accessors.c mi/Gget_proc_info_by_ip.c \ + mi/Gget_proc_name.c mi/Gput_dynamic_unwind_info.c \ + mi/Gdestroy_addr_space.c mi/Gget_reg.c mi/Gset_reg.c \ + mi/Gget_fpreg.c mi/Gset_fpreg.c mi/Gset_caching_policy.c \ + mi/Gset_cache_size.c sw_64/Gapply_reg_state.c \ + sw_64/Greg_states_iterate.c sw_64/Gcreate_addr_space.c \ + sw_64/Gget_proc_info.c sw_64/Gget_save_loc.c sw_64/Gglobal.c sw_64/Ginit.c \ + sw_64/Ginit_local.c sw_64/Ginit_remote.c sw_64/Gis_signal_frame.c \ + sw_64/Gregs.c sw_64/Gresume.c sw_64/Gstep.c +am__objects_72 = $(am__objects_7) sw_64/is_fpreg.lo sw_64/regname.lo +am__objects_73 = $(am__objects_72) $(am__objects_9) \ + sw_64/Gapply_reg_state.lo sw_64/Greg_states_iterate.lo \ + sw_64/Gcreate_addr_space.lo sw_64/Gget_proc_info.lo \ + sw_64/Gget_save_loc.lo sw_64/Gglobal.lo sw_64/Ginit.lo \ + sw_64/Ginit_local.lo sw_64/Ginit_remote.lo sw_64/Gis_signal_frame.lo \ + sw_64/Gregs.lo sw_64/Gresume.lo sw_64/Gstep.lo +@ARCH_SW_64_TRUE@am_libunwind_sw_64_la_OBJECTS = $(am__objects_73) +libunwind_sw_64_la_OBJECTS = $(am_libunwind_sw_64_la_OBJECTS) +libunwind_sw_64_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC \ + $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(AM_CFLAGS) $(CFLAGS) $(libunwind_sw_64_la_LDFLAGS) $(LDFLAGS) \ + -o $@ +@ARCH_SW_64_TRUE@am_libunwind_sw_64_la_rpath = -rpath \ +@ARCH_SW_64_TRUE@ $(libdir) +am__objects_74 = $(am__objects_72) $(am__objects_54) \ + sw_64/getcontext.lo sw_64/Lapply_reg_state.lo \ + sw_64/Lreg_states_iterate.lo sw_64/Lcreate_addr_space.lo \ + sw_64/Lget_proc_info.lo sw_64/Lget_save_loc.lo sw_64/Lglobal.lo \ + sw_64/Linit.lo sw_64/Linit_local.lo sw_64/Linit_remote.lo \ + sw_64/Lis_signal_frame.lo sw_64/Lregs.lo sw_64/Lresume.lo \ + sw_64/Lstep.lo +@ARCH_SW_64_TRUE@am_libunwind_la_OBJECTS = $(am__objects_74) + libunwind_la_OBJECTS = $(am_libunwind_la_OBJECTS) libunwind_la_LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ @@ -1247,6 +1312,25 @@ sh/$(DEPDIR)/Lresume.Plo sh/$(DEPDIR)/Lstep.Plo \ sh/$(DEPDIR)/is_fpreg.Plo sh/$(DEPDIR)/regname.Plo \ sh/$(DEPDIR)/siglongjmp.Plo \ + sw_64/$(DEPDIR)/Gapply_reg_state.Plo \ + sw_64/$(DEPDIR)/Gcreate_addr_space.Plo \ + sw_64/$(DEPDIR)/Gget_proc_info.Plo sw_64/$(DEPDIR)/Gget_save_loc.Plo \ + sw_64/$(DEPDIR)/Gglobal.Plo sw_64/$(DEPDIR)/Ginit.Plo \ + sw_64/$(DEPDIR)/Ginit_local.Plo sw_64/$(DEPDIR)/Ginit_remote.Plo \ + sw_64/$(DEPDIR)/Gis_signal_frame.Plo \ + sw_64/$(DEPDIR)/Greg_states_iterate.Plo sw_64/$(DEPDIR)/Gregs.Plo \ + sw_64/$(DEPDIR)/Gresume.Plo sw_64/$(DEPDIR)/Gstep.Plo \ + sw_64/$(DEPDIR)/Lapply_reg_state.Plo \ + sw_64/$(DEPDIR)/Lcreate_addr_space.Plo \ + sw_64/$(DEPDIR)/Lget_proc_info.Plo sw_64/$(DEPDIR)/Lget_save_loc.Plo \ + sw_64/$(DEPDIR)/Lglobal.Plo sw_64/$(DEPDIR)/Linit.Plo \ + sw_64/$(DEPDIR)/Linit_local.Plo sw_64/$(DEPDIR)/Linit_remote.Plo \ + sw_64/$(DEPDIR)/Lis_signal_frame.Plo \ + sw_64/$(DEPDIR)/Lreg_states_iterate.Plo sw_64/$(DEPDIR)/Lregs.Plo \ + sw_64/$(DEPDIR)/Lresume.Plo sw_64/$(DEPDIR)/Lstep.Plo \ + sw_64/$(DEPDIR)/getcontext.Plo \ + sw_64/$(DEPDIR)/is_fpreg.Plo sw_64/$(DEPDIR)/regname.Plo \ + sw_64/$(DEPDIR)/siglongjmp.Plo \ tilegx/$(DEPDIR)/Gapply_reg_state.Plo \ tilegx/$(DEPDIR)/Gcreate_addr_space.Plo \ tilegx/$(DEPDIR)/Gget_proc_info.Plo \ @@ -1377,6 +1461,7 @@ $(libunwind_ppc32_la_SOURCES) $(libunwind_ppc64_la_SOURCES) \ $(libunwind_ptrace_la_SOURCES) $(libunwind_s390x_la_SOURCES) \ $(libunwind_setjmp_la_SOURCES) $(libunwind_sh_la_SOURCES) \ + $(libunwind_sw_64_la_SOURCES) \ $(libunwind_tilegx_la_SOURCES) $(libunwind_x86_la_SOURCES) \ $(libunwind_x86_64_la_SOURCES) $(libunwind_la_SOURCES) DIST_SOURCES = $(am__libunwind_aarch64_la_SOURCES_DIST) \ @@ -1396,6 +1481,7 @@ $(am__libunwind_s390x_la_SOURCES_DIST) \ $(am__libunwind_setjmp_la_SOURCES_DIST) \ $(am__libunwind_sh_la_SOURCES_DIST) \ + $(am__libunwind_sw_64_la_SOURCES_DIST) \ $(am__libunwind_tilegx_la_SOURCES_DIST) \ $(am__libunwind_x86_la_SOURCES_DIST) \ $(am__libunwind_x86_64_la_SOURCES_DIST) \ @@ -1589,6 +1675,8 @@ $(am__append_31) $(am__append_34) $(am__append_37) \ $(am__append_40) $(am__append_43) $(am__append_46) \ $(am__append_48) +lib_LTLIBRARIES = $(am__append_1) $(am__append_2) $(am__append_3) \ + $(am__append_49) $(am__append_52) # The list of files that go into libunwind and libunwind-aarch64: @@ -1612,6 +1700,8 @@ # The list of files that go into libunwind and libunwind-sh: +# The list of files that go into libunwind and libunwind-sw_64: + # The list of files that go both into libunwind and libunwind-s390x: noinst_HEADERS = ptrace/_UPT_internal.h coredump/_UCD_internal.h \ coredump/_UCD_lib.h setjmp/setjmp_i.h os-linux.h elf32.h \ @@ -1626,6 +1716,7 @@ x86_64/ucontext_i.h ppc32/init.h ppc32/unwind_i.h \ ppc32/ucontext_i.h ppc64/init.h ppc64/unwind_i.h \ ppc64/ucontext_i.h sh/init.h sh/offsets.h sh/unwind_i.h \ + sw_64/init.h sw_64/offsets.h sw_64/unwind_i.h \ s390x/init.h s390x/unwind_i.h unwind/unwind-internal.h noinst_LTLIBRARIES = $(am__append_8) $(am__append_9) $(LIBUNWIND_ELF) pkgconfigdir = $(libdir)/pkgconfig @@ -1673,6 +1764,8 @@ $(am__append_24) $(am__append_27) $(am__append_30) \ $(am__append_33) $(am__append_36) $(am__append_39) \ $(am__append_42) $(am__append_45) +libunwind_setjmp_la_SOURCES = setjmp/longjmp.c setjmp/siglongjmp.c \ + $(am__append_51) ### libunwind: libunwind_la_LIBADD = $(am__append_10) $(LIBUNWIND_ELF) -lc $(LIBCRTS) \ @@ -2022,6 +2115,26 @@ sh/Gglobal.c sh/Ginit.c sh/Ginit_local.c sh/Ginit_remote.c \ sh/Gis_signal_frame.c sh/Gregs.c sh/Gresume.c sh/Gstep.c +libunwind_la_SOURCES_sw_64_common = $(libunwind_la_SOURCES_common) \ +sw_64/is_fpreg.c sw_64/regname.c + + +# The list of files that go into libunwind: +libunwind_la_SOURCES_sw_64 = $(libunwind_la_SOURCES_sw_64_common) \ + $(libunwind_la_SOURCES_local) \ + sw_64/getcontext.S \ + sw_64/Lapply_reg_state.c sw_64/Lreg_states_iterate.c \ + sw_64/Lcreate_addr_space.c sw_64/Lget_proc_info.c sw_64/Lget_save_loc.c \ + sw_64/Lglobal.c sw_64/Linit.c sw_64/Linit_local.c sw_64/Linit_remote.c \ + sw_64/Lis_signal_frame.c sw_64/Lregs.c sw_64/Lresume.c sw_64/Lstep.c + +libunwind_sw_64_la_SOURCES_sw_64 = $(libunwind_la_SOURCES_sw_64_common) \ + $(libunwind_la_SOURCES_generic) \ + sw_64/Gapply_reg_state.c sw_64/Greg_states_iterate.c \ + sw_64/Gcreate_addr_space.c sw_64/Gget_proc_info.c sw_64/Gget_save_loc.c \ + sw_64/Gglobal.c sw_64/Ginit.c sw_64/Ginit_local.c sw_64/Ginit_remote.c \ + sw_64/Gis_signal_frame.c sw_64/Gregs.c sw_64/Gresume.c sw_64/Gstep.c + libunwind_la_SOURCES_s390x_common = $(libunwind_la_SOURCES_common) \ s390x/is_fpreg.c s390x/regname.c @@ -2146,6 +2259,12 @@ @ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_s390x_la_LIBADD = libunwind-dwarf-generic.la \ @ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elf64.la \ @ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_S390X_TRUE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_47) +@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SW_64_TRUE@@ARCH_S390X_FALSE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sw_64_la_SOURCES = $(libunwind_sw_64_la_SOURCES_sw_64) +@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SW_64_TRUE@@ARCH_S390X_FALSE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sw_64_la_LDFLAGS = $(COMMON_SO_LDFLAGS) -version-info $(SOVERSION) +@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SW_64_TRUE@@ARCH_S390X_FALSE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@libunwind_sw_64_la_LIBADD = libunwind-dwarf-generic.la \ +@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SW_64_TRUE@@ARCH_S390X_FALSE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ libunwind-elfxx.la \ +@ARCH_AARCH64_FALSE@@ARCH_ARM_FALSE@@ARCH_HPPA_FALSE@@ARCH_IA64_FALSE@@ARCH_MIPS_FALSE@@ARCH_PPC32_FALSE@@ARCH_PPC64_FALSE@@ARCH_SW_64_TRUE@@ARCH_S390X_FALSE@@ARCH_SH_FALSE@@ARCH_TILEGX_FALSE@@ARCH_X86_64_FALSE@@ARCH_X86_FALSE@ $(am__append_50) + # # Don't link with standard libraries, because those may mention @@ -2162,6 +2281,7 @@ $(libunwind_la_SOURCES_ia64) \ $(libunwind_la_SOURCES_mips) \ $(libunwind_la_SOURCES_sh) \ + $(libunwind_la_SOURCES_sw_64) \ $(libunwind_la_SOURCES_x86) \ $(libunwind_la_SOURCES_os_freebsd) \ $(libunwind_la_SOURCES_os_linux) \ @@ -2177,6 +2297,7 @@ $(libunwind_ia64_la_SOURCES_ia64) \ $(libunwind_mips_la_SOURCES_mips) \ $(libunwind_sh_la_SOURCES_sh) \ + $(libunwind_sw_64_la_SOURCES_sw_64) \ $(libunwind_x86_la_SOURCES_x86) \ $(libunwind_x86_64_la_SOURCES_x86_64) @@ -2805,6 +2926,38 @@ libunwind-sh.la: $(libunwind_sh_la_OBJECTS) $(libunwind_sh_la_DEPENDENCIES) $(EXTRA_libunwind_sh_la_DEPENDENCIES) $(AM_V_CCLD)$(libunwind_sh_la_LINK) $(am_libunwind_sh_la_rpath) $(libunwind_sh_la_OBJECTS) $(libunwind_sh_la_LIBADD) $(LIBS) +sw_64/$(am__dirstamp): + @$(MKDIR_P) sw_64 + @: > sw_64/$(am__dirstamp) +sw_64/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) sw_64/$(DEPDIR) + @: > sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/siglongjmp.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) + +libunwind-setjmp.la: $(libunwind_setjmp_la_OBJECTS) $(libunwind_setjmp_la_DEPENDENCIES) $(EXTRA_libunwind_setjmp_la_DEPENDENCIES) + $(AM_V_CCLD)$(libunwind_setjmp_la_LINK) $(am_libunwind_setjmp_la_rpath) $(libunwind_setjmp_la_OBJECTS) $(libunwind_setjmp_la_LIBADD) $(LIBS) +sw_64/is_fpreg.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/regname.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gapply_reg_state.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Greg_states_iterate.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gcreate_addr_space.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gget_proc_info.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gget_save_loc.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gglobal.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Ginit.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Ginit_local.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Ginit_remote.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gis_signal_frame.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gregs.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gresume.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Gstep.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) + +libunwind-sw_64.la: $(libunwind_sw_64_la_OBJECTS) $(libunwind_sw_64_la_DEPENDENCIES) $(EXTRA_libunwind_sw_64_la_DEPENDENCIES) + $(AM_V_CCLD)$(libunwind_sw_64_la_LINK) $(am_libunwind_sw_64_la_rpath) $(libunwind_sw_64_la_OBJECTS) $(libunwind_sw_64_la_LIBADD) $(LIBS) tilegx/is_fpreg.lo: tilegx/$(am__dirstamp) \ tilegx/$(DEPDIR)/$(am__dirstamp) tilegx/regname.lo: tilegx/$(am__dirstamp) \ @@ -3013,6 +3166,25 @@ sh/Lregs.lo: sh/$(am__dirstamp) sh/$(DEPDIR)/$(am__dirstamp) sh/Lresume.lo: sh/$(am__dirstamp) sh/$(DEPDIR)/$(am__dirstamp) sh/Lstep.lo: sh/$(am__dirstamp) sh/$(DEPDIR)/$(am__dirstamp) +sw_64/getcontext.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lapply_reg_state.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lreg_states_iterate.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lcreate_addr_space.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lget_proc_info.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lget_save_loc.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lglobal.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Linit.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Linit_local.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Linit_remote.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lis_signal_frame.lo: sw_64/$(am__dirstamp) \ + sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lregs.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lresume.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) +sw_64/Lstep.lo: sw_64/$(am__dirstamp) sw_64/$(DEPDIR)/$(am__dirstamp) ppc/Lget_proc_info.lo: ppc/$(am__dirstamp) \ ppc/$(DEPDIR)/$(am__dirstamp) ppc/Lget_save_loc.lo: ppc/$(am__dirstamp) \ @@ -3309,6 +3481,8 @@ -rm -f setjmp/*.lo -rm -f sh/*.$(OBJEXT) -rm -f sh/*.lo + -rm -f sw_64/*.$(OBJEXT) + -rm -f sw_64/*.lo -rm -f tilegx/*.$(OBJEXT) -rm -f tilegx/*.lo -rm -f unwind/*.$(OBJEXT) @@ -3696,6 +3870,36 @@ @AMDEP_TRUE@@am__include@ @am__quote@sh/$(DEPDIR)/is_fpreg.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@sh/$(DEPDIR)/regname.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@sh/$(DEPDIR)/siglongjmp.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gapply_reg_state.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gcreate_addr_space.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gget_proc_info.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gget_save_loc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gglobal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Ginit.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Ginit_local.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Ginit_remote.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gis_signal_frame.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Greg_states_iterate.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gregs.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gresume.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Gstep.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lapply_reg_state.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lcreate_addr_space.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lget_proc_info.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lget_save_loc.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lglobal.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Linit.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Linit_local.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Linit_remote.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lis_signal_frame.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lreg_states_iterate.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lregs.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lresume.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/Lstep.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/getcontext.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/is_fpreg.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/regname.Plo@am__quote@ # am--include-marker +@AMDEP_TRUE@@am__include@ @am__quote@sw_64/$(DEPDIR)/siglongjmp.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tilegx/$(DEPDIR)/Gapply_reg_state.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tilegx/$(DEPDIR)/Gcreate_addr_space.Plo@am__quote@ # am--include-marker @AMDEP_TRUE@@am__include@ @am__quote@tilegx/$(DEPDIR)/Gget_proc_info.Plo@am__quote@ # am--include-marker @@ -3893,6 +4097,7 @@ -rm -rf s390x/.libs s390x/_libs -rm -rf setjmp/.libs setjmp/_libs -rm -rf sh/.libs sh/_libs + -rm -rf sw_64/.libs sw_64/_libs -rm -rf tilegx/.libs tilegx/_libs -rm -rf unwind/.libs unwind/_libs -rm -rf x86/.libs x86/_libs @@ -4069,6 +4274,8 @@ -rm -f setjmp/$(am__dirstamp) -rm -f sh/$(DEPDIR)/$(am__dirstamp) -rm -f sh/$(am__dirstamp) + -rm -f sw_64/$(DEPDIR)/$(am__dirstamp) + -rm -f sw_64/$(am__dirstamp) -rm -f tilegx/$(DEPDIR)/$(am__dirstamp) -rm -f tilegx/$(am__dirstamp) -rm -f unwind/$(DEPDIR)/$(am__dirstamp) @@ -4464,6 +4671,36 @@ -rm -f sh/$(DEPDIR)/is_fpreg.Plo -rm -f sh/$(DEPDIR)/regname.Plo -rm -f sh/$(DEPDIR)/siglongjmp.Plo + -rm -f sw_64/$(DEPDIR)/Gapply_reg_state.Plo + -rm -f sw_64/$(DEPDIR)/Gcreate_addr_space.Plo + -rm -f sw_64/$(DEPDIR)/Gget_proc_info.Plo + -rm -f sw_64/$(DEPDIR)/Gget_save_loc.Plo + -rm -f sw_64/$(DEPDIR)/Gglobal.Plo + -rm -f sw_64/$(DEPDIR)/Ginit.Plo + -rm -f sw_64/$(DEPDIR)/Ginit_local.Plo + -rm -f sw_64/$(DEPDIR)/Ginit_remote.Plo + -rm -f sw_64/$(DEPDIR)/Gis_signal_frame.Plo + -rm -f sw_64/$(DEPDIR)/Greg_states_iterate.Plo + -rm -f sw_64/$(DEPDIR)/Gregs.Plo + -rm -f sw_64/$(DEPDIR)/Gresume.Plo + -rm -f sw_64/$(DEPDIR)/Gstep.Plo + -rm -f sw_64/$(DEPDIR)/Lapply_reg_state.Plo + -rm -f sw_64/$(DEPDIR)/Lcreate_addr_space.Plo + -rm -f sw_64/$(DEPDIR)/Lget_proc_info.Plo + -rm -f sw_64/$(DEPDIR)/Lget_save_loc.Plo + -rm -f sw_64/$(DEPDIR)/Lglobal.Plo + -rm -f sw_64/$(DEPDIR)/Linit.Plo + -rm -f sw_64/$(DEPDIR)/Linit_local.Plo + -rm -f sw_64/$(DEPDIR)/Linit_remote.Plo + -rm -f sw_64/$(DEPDIR)/Lis_signal_frame.Plo + -rm -f sw_64/$(DEPDIR)/Lreg_states_iterate.Plo + -rm -f sw_64/$(DEPDIR)/Lregs.Plo + -rm -f sw_64/$(DEPDIR)/Lresume.Plo + -rm -f sw_64/$(DEPDIR)/Lstep.Plo + -rm -f sw_64/$(DEPDIR)/getcontext.Plo + -rm -f sw_64/$(DEPDIR)/is_fpreg.Plo + -rm -f sw_64/$(DEPDIR)/regname.Plo + -rm -f sw_64/$(DEPDIR)/siglongjmp.Plo -rm -f tilegx/$(DEPDIR)/Gapply_reg_state.Plo -rm -f tilegx/$(DEPDIR)/Gcreate_addr_space.Plo -rm -f tilegx/$(DEPDIR)/Gget_proc_info.Plo @@ -5007,6 +5244,36 @@ -rm -f sh/$(DEPDIR)/is_fpreg.Plo -rm -f sh/$(DEPDIR)/regname.Plo -rm -f sh/$(DEPDIR)/siglongjmp.Plo + -rm -f sw_64/$(DEPDIR)/Gapply_reg_state.Plo + -rm -f sw_64/$(DEPDIR)/Gcreate_addr_space.Plo + -rm -f sw_64/$(DEPDIR)/Gget_proc_info.Plo + -rm -f sw_64/$(DEPDIR)/Gget_save_loc.Plo + -rm -f sw_64/$(DEPDIR)/Gglobal.Plo + -rm -f sw_64/$(DEPDIR)/Ginit.Plo + -rm -f sw_64/$(DEPDIR)/Ginit_local.Plo + -rm -f sw_64/$(DEPDIR)/Ginit_remote.Plo + -rm -f sw_64/$(DEPDIR)/Gis_signal_frame.Plo + -rm -f sw_64/$(DEPDIR)/Greg_states_iterate.Plo + -rm -f sw_64/$(DEPDIR)/Gregs.Plo + -rm -f sw_64/$(DEPDIR)/Gresume.Plo + -rm -f sw_64/$(DEPDIR)/Gstep.Plo + -rm -f sw_64/$(DEPDIR)/Lapply_reg_state.Plo + -rm -f sw_64/$(DEPDIR)/Lcreate_addr_space.Plo + -rm -f sw_64/$(DEPDIR)/Lget_proc_info.Plo + -rm -f sw_64/$(DEPDIR)/Lget_save_loc.Plo + -rm -f sw_64/$(DEPDIR)/Lglobal.Plo + -rm -f sw_64/$(DEPDIR)/Linit.Plo + -rm -f sw_64/$(DEPDIR)/Linit_local.Plo + -rm -f sw_64/$(DEPDIR)/Linit_remote.Plo + -rm -f sw_64/$(DEPDIR)/Lis_signal_frame.Plo + -rm -f sw_64/$(DEPDIR)/Lreg_states_iterate.Plo + -rm -f sw_64/$(DEPDIR)/Lregs.Plo + -rm -f sw_64/$(DEPDIR)/Lresume.Plo + -rm -f sw_64/$(DEPDIR)/Lstep.Plo + -rm -f sw_64/$(DEPDIR)/getcontext.Plo + -rm -f sw_64/$(DEPDIR)/is_fpreg.Plo + -rm -f sw_64/$(DEPDIR)/regname.Plo + -rm -f sw_64/$(DEPDIR)/siglongjmp.Plo -rm -f tilegx/$(DEPDIR)/Gapply_reg_state.Plo -rm -f tilegx/$(DEPDIR)/Gcreate_addr_space.Plo -rm -f tilegx/$(DEPDIR)/Gget_proc_info.Plo diff -Nuar libunwind-1.5.0.org/src/coredump/_UCD_access_reg_linux.c libunwind-1.5.0.sw/src/coredump/_UCD_access_reg_linux.c --- libunwind-1.5.0.org/src/coredump/_UCD_access_reg_linux.c 2022-03-24 07:05:05.073873440 +0000 +++ libunwind-1.5.0.sw/src/coredump/_UCD_access_reg_linux.c 2022-03-16 09:18:38.000000000 +0000 @@ -122,6 +122,43 @@ [UNW_X86_64_RSP] = offsetof(struct user_regs_struct, rsp) / sizeof(long), [UNW_X86_64_RIP] = offsetof(struct user_regs_struct, rip) / sizeof(long), }; +#elif defined(UNW_TARGET_SW_64) + static const uint8_t remap_regs[] = + { + [UNW_SW_64_R0] = 0, + [UNW_SW_64_R1] = 1, + [UNW_SW_64_R2] = 2, + [UNW_SW_64_R3] = 3, + [UNW_SW_64_R4] = 4, + [UNW_SW_64_R5] = 5, + [UNW_SW_64_R6] = 6, + [UNW_SW_64_R7] = 7, + [UNW_SW_64_R8] = 8, + [UNW_SW_64_R9] = 9, + [UNW_SW_64_R10] = 10, + [UNW_SW_64_R11] = 11, + [UNW_SW_64_R12] = 12, + [UNW_SW_64_R13] = 13, + [UNW_SW_64_R14] = 14, + [UNW_SW_64_R15] = 15, + [UNW_SW_64_R16] = 16, + [UNW_SW_64_R17] = 17, + [UNW_SW_64_R18] = 18, + [UNW_SW_64_R19] = 19, + [UNW_SW_64_R20] = 20, + [UNW_SW_64_R21] = 21, + [UNW_SW_64_R22] = 22, + [UNW_SW_64_R23] = 23, + [UNW_SW_64_R24] = 24, + [UNW_SW_64_R25] = 25, + [UNW_SW_64_R26] = 26, + [UNW_SW_64_R27] = 27, + [UNW_SW_64_R28] = 28, + [UNW_SW_64_R29] = 29, + [UNW_SW_64_R30] = 30, + [UNW_SW_64_PC] = 31, + [UNW_SW_64_R31] = 32, + }; #else #error Port me #endif diff -Nuar libunwind-1.5.0.org/src/ptrace/_UPT_reg_offset.c libunwind-1.5.0.sw/src/ptrace/_UPT_reg_offset.c --- libunwind-1.5.0.org/src/ptrace/_UPT_reg_offset.c 2022-03-24 07:05:05.073873440 +0000 +++ libunwind-1.5.0.sw/src/ptrace/_UPT_reg_offset.c 2022-03-16 09:18:38.000000000 +0000 @@ -632,6 +632,72 @@ [UNW_TILEGX_R54] = 0x1b0, [UNW_TILEGX_R55] = 0x1b8, [UNW_TILEGX_PC] = 0x1a0 +#elif defined(UNW_TARGET_SW_64) + [UNW_SW_64_R0] = 0x00, + [UNW_SW_64_R1] = 0x1, + [UNW_SW_64_R2] = 0x2, + [UNW_SW_64_R3] = 0x3, + [UNW_SW_64_R4] = 0x4, + [UNW_SW_64_R5] = 0x5, + [UNW_SW_64_R6] = 0x6, + [UNW_SW_64_R7] = 0x7, + [UNW_SW_64_R8] = 0x8, + [UNW_SW_64_R9] = 0x9, + [UNW_SW_64_R10] = 10, + [UNW_SW_64_R11] = 11, + [UNW_SW_64_R12] = 12, + [UNW_SW_64_R13] = 13, + [UNW_SW_64_R14] = 14, + [UNW_SW_64_R15] = 0xf, + [UNW_SW_64_R16] = 0x10, + [UNW_SW_64_R17] = 0x11, + [UNW_SW_64_R18] = 0x12, + [UNW_SW_64_R19] = 0x13, + [UNW_SW_64_R20] = 0x14, + [UNW_SW_64_R21] = 0x15, + [UNW_SW_64_R22] = 0x16, + [UNW_SW_64_R23] = 0x17, + [UNW_SW_64_R24] = 0x18, + [UNW_SW_64_R25] = 0x19, + [UNW_SW_64_R26] = 0x1a, + [UNW_SW_64_R27] = 0x1b, + [UNW_SW_64_R28] = 0x1c, + [UNW_SW_64_R29] = 0x1d, + [UNW_SW_64_R30] = 0x1e, + [UNW_SW_64_R31] = 0x1f, + [UNW_SW_64_F0] = 0x20, + [UNW_SW_64_F1] = 0x21, + [UNW_SW_64_F2] = 0x22, + [UNW_SW_64_F3] = 0x23, + [UNW_SW_64_F4] = 0x24, + [UNW_SW_64_F5] = 0x25, + [UNW_SW_64_F6] = 0x26, + [UNW_SW_64_F7] = 0x27, + [UNW_SW_64_F8] = 0x28, + [UNW_SW_64_F9] = 0x29, + [UNW_SW_64_F10] = 0x2a, + [UNW_SW_64_F11] = 0x2b, + [UNW_SW_64_F12] = 0x2c, + [UNW_SW_64_F13] = 0x2d, + [UNW_SW_64_F14] = 0x2e, + [UNW_SW_64_F15] = 0x2f, + [UNW_SW_64_F16] = 0x30, + [UNW_SW_64_F17] = 0x31, + [UNW_SW_64_F18] = 0x32, + [UNW_SW_64_F19] = 0x33, + [UNW_SW_64_F20] = 0x34, + [UNW_SW_64_F21] = 0x35, + [UNW_SW_64_F22] = 0x36, + [UNW_SW_64_F23] = 0x37, + [UNW_SW_64_F24] = 0x38, + [UNW_SW_64_F25] = 0x39, + [UNW_SW_64_F26] = 0x3a, + [UNW_SW_64_F27] = 0x3b, + [UNW_SW_64_F28] = 0x3c, + [UNW_SW_64_F29] = 0x3d, + [UNW_SW_64_F30] = 0x3e, + [UNW_SW_64_FPCR] = 0x3f, + [UNW_SW_64_PC] = 0x40, #elif defined(UNW_TARGET_S390X) [UNW_S390X_R0] = 0x10, [UNW_S390X_R1] = 0x18, diff -Nuar libunwind-1.5.0.org/src/sw_64/Gapply_reg_state.c libunwind-1.5.0.sw/src/sw_64/Gapply_reg_state.c --- libunwind-1.5.0.org/src/sw_64/Gapply_reg_state.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gapply_reg_state.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,37 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang <davidm@hpl.hp.com> + + Modified for x86_64 by Max Asbock <masbock@us.ibm.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. */ + +#include "unwind_i.h" + +int +unw_apply_reg_state (unw_cursor_t *cursor, + void *reg_states_data) +{ + struct cursor *c = (struct cursor *) cursor; + + return dwarf_apply_reg_state (&c->dwarf, (dwarf_reg_state_t *)reg_states_data); +} diff -Nuar libunwind-1.5.0.org/src/sw_64/Gcreate_addr_space.c libunwind-1.5.0.sw/src/sw_64/Gcreate_addr_space.c --- libunwind-1.5.0.org/src/sw_64/Gcreate_addr_space.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gcreate_addr_space.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,65 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include <stdlib.h> + +#include "unwind_i.h" + +unw_addr_space_t +unw_create_addr_space (unw_accessors_t *a, int byte_order) +{ +#ifdef UNW_LOCAL_ONLY + return NULL; +#else + unw_addr_space_t as; + + /* + * SW_64 supports only big or little-endian, not weird stuff like + * PDP_ENDIAN. + */ + if (byte_order != 0 + && byte_order != __LITTLE_ENDIAN + && byte_order != __BIG_ENDIAN) + return NULL; + + as = malloc (sizeof (*as)); + if (!as) + return NULL; + + memset (as, 0, sizeof (*as)); + + as->acc = *a; + + if (byte_order == 0) + /* use host default: */ + as->big_endian = (__BYTE_ORDER == __BIG_ENDIAN); + else + as->big_endian = (byte_order == __BIG_ENDIAN); + + /* FIXME! There is no way to specify the ABI. */ + as->abi = UNW_SW_64_ABI_N64; + + return as; +#endif +} diff -Nuar libunwind-1.5.0.org/src/sw_64/Gget_proc_info.c libunwind-1.5.0.sw/src/sw_64/Gget_proc_info.c --- libunwind-1.5.0.org/src/sw_64/Gget_proc_info.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gget_proc_info.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,44 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" + +int +unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + ret = dwarf_make_proc_info (&c->dwarf); + if (ret < 0) { + /* Construct a dummy proc info if Dwarf failed */ + memset (pi, 0, sizeof (*pi)); + pi->start_ip = c->dwarf.ip; + pi->end_ip = c->dwarf.ip + 4; + return 0; + } + + *pi = c->dwarf.pi; + return 0; +} diff -Nuar libunwind-1.5.0.org/src/sw_64/Gget_save_loc.c libunwind-1.5.0.sw/src/sw_64/Gget_save_loc.c --- libunwind-1.5.0.org/src/sw_64/Gget_save_loc.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gget_save_loc.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,132 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" + +/* FIXME for SW_64. */ + +int +unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc) +{ + struct cursor *c = (struct cursor *) cursor; + dwarf_loc_t loc; + + loc = DWARF_NULL_LOC; /* default to "not saved" */ + + switch (reg) + { + case UNW_SW_64_R0: + case UNW_SW_64_R1: + case UNW_SW_64_R2: + case UNW_SW_64_R3: + case UNW_SW_64_R4: + case UNW_SW_64_R5: + case UNW_SW_64_R6: + case UNW_SW_64_R7: + case UNW_SW_64_R8: + case UNW_SW_64_R9: + case UNW_SW_64_R10: + case UNW_SW_64_R11: + case UNW_SW_64_R12: + case UNW_SW_64_R13: + case UNW_SW_64_R14: + case UNW_SW_64_R15: + case UNW_SW_64_R16: + case UNW_SW_64_R17: + case UNW_SW_64_R18: + case UNW_SW_64_R19: + case UNW_SW_64_R20: + case UNW_SW_64_R21: + case UNW_SW_64_R22: + case UNW_SW_64_R23: + case UNW_SW_64_R24: + case UNW_SW_64_R25: + case UNW_SW_64_R26: + case UNW_SW_64_R27: + case UNW_SW_64_R28: + case UNW_SW_64_R29: + case UNW_SW_64_R30: + case UNW_SW_64_R31: + case UNW_SW_64_F0: + case UNW_SW_64_F1: + case UNW_SW_64_F2: + case UNW_SW_64_F3: + case UNW_SW_64_F4: + case UNW_SW_64_F5: + case UNW_SW_64_F6: + case UNW_SW_64_F7: + case UNW_SW_64_F8: + case UNW_SW_64_F9: + case UNW_SW_64_F10: + case UNW_SW_64_F11: + case UNW_SW_64_F12: + case UNW_SW_64_F13: + case UNW_SW_64_F14: + case UNW_SW_64_F15: + case UNW_SW_64_F16: + case UNW_SW_64_F17: + case UNW_SW_64_F18: + case UNW_SW_64_F19: + case UNW_SW_64_F20: + case UNW_SW_64_F21: + case UNW_SW_64_F22: + case UNW_SW_64_F23: + case UNW_SW_64_F24: + case UNW_SW_64_F25: + case UNW_SW_64_F26: + case UNW_SW_64_F27: + case UNW_SW_64_F28: + case UNW_SW_64_F29: + case UNW_SW_64_F30: + case UNW_SW_64_FPCR: + case UNW_SW_64_PC: + loc = c->dwarf.loc[reg - UNW_SW_64_R0]; + break; + + default: + break; + } + + memset (sloc, 0, sizeof (*sloc)); + + if (DWARF_IS_NULL_LOC (loc)) + { + sloc->type = UNW_SLT_NONE; + return 0; + } + +#if !defined(UNW_LOCAL_ONLY) + if (DWARF_IS_REG_LOC (loc)) + { + sloc->type = UNW_SLT_REG; + sloc->u.regnum = DWARF_GET_LOC (loc); + } + else +#endif + { + sloc->type = UNW_SLT_MEMORY; + sloc->u.addr = DWARF_GET_LOC (loc); + } + return 0; +} diff -Nuar libunwind-1.5.0.org/src/sw_64/Gglobal.c libunwind-1.5.0.sw/src/sw_64/Gglobal.c --- libunwind-1.5.0.org/src/sw_64/Gglobal.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gglobal.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,56 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" +#include "dwarf_i.h" + +HIDDEN define_lock (sw_64_lock); +HIDDEN int tdep_init_done; + +HIDDEN void +tdep_init (void) +{ + intrmask_t saved_mask; + + sigfillset (&unwi_full_mask); + sigdelset(&unwi_full_mask, 5); /* LIJM */ + + lock_acquire (&sw_64_lock, saved_mask); + { + if (tdep_init_done) + /* another thread else beat us to it... */ + goto out; + + mi_init (); + + dwarf_init (); + +#ifndef UNW_REMOTE_ONLY + sw_64_local_addr_space_init (); +#endif + tdep_init_done = 1; /* signal that we're initialized... */ + } + out: + lock_release (&sw_64_lock, saved_mask); +} diff -Nuar libunwind-1.5.0.org/src/sw_64/Ginit.c libunwind-1.5.0.sw/src/sw_64/Ginit.c --- libunwind-1.5.0.org/src/sw_64/Ginit.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Ginit.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,202 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include <stdlib.h> +#include <string.h> + +#include "unwind_i.h" + +#ifdef UNW_REMOTE_ONLY + +/* unw_local_addr_space is a NULL pointer in this case. */ +unw_addr_space_t unw_local_addr_space; + +#else /* !UNW_REMOTE_ONLY */ + +static struct unw_addr_space local_addr_space; + +unw_addr_space_t unw_local_addr_space = &local_addr_space; + +/* Return the address of the 64-bit slot in UC for REG (even for o32, + where registers are 32-bit, the slots are still 64-bit). */ + +static inline void * +uc_addr (ucontext_t *uc, int reg) +{ + if (reg >= UNW_SW_64_R0 && reg < UNW_SW_64_R0 + 32) + return &uc->uc_mcontext.sc_regs[reg - UNW_SW_64_R0]; + else if (reg >= UNW_SW_64_F0 && reg < UNW_SW_64_F0 + 32) + return &uc->uc_mcontext.sc_fpregs[reg - UNW_SW_64_F0]; + else if (reg == UNW_SW_64_PC) + return &uc->uc_mcontext.sc_pc; + else + return NULL; +} + +# ifdef UNW_LOCAL_ONLY + +HIDDEN void * +tdep_uc_addr (ucontext_t *uc, int reg) +{ + char *addr = uc_addr (uc, reg); +#if 0 + if (((reg >= UNW_SW_64_R0 && reg <= UNW_SW_64_R31) || reg == UNW_SW_64_PC) + && tdep_big_endian (unw_local_addr_space)) + addr += 4; +#endif + return addr; +} + +# endif /* UNW_LOCAL_ONLY */ + +static void +put_unwind_info (unw_addr_space_t as, unw_proc_info_t *proc_info, void *arg) +{ + /* it's a no-op */ +} + +static int +get_dyn_info_list_addr (unw_addr_space_t as, unw_word_t *dyn_info_list_addr, + void *arg) +{ +#ifndef UNW_LOCAL_ONLY +# pragma weak _U_dyn_info_list_addr + if (!_U_dyn_info_list_addr) + return -UNW_ENOINFO; +#endif + // Access the `_U_dyn_info_list` from `LOCAL_ONLY` library, i.e. libunwind.so. + *dyn_info_list_addr = _U_dyn_info_list_addr (); + return 0; +} + +static int +access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write, + void *arg) +{ + if (write) + { + Debug (16, "mem[%llx] <- %llx\n", (long long) addr, (long long) *val); + *(unw_word_t *) (intptr_t) addr = *val; + } + else + { + *val = *(unw_word_t *) (intptr_t) addr; + Debug (16, "mem[%llx] -> %llx\n", (long long) addr, (long long) *val); + } + return 0; +} + +static int +access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write, + void *arg) +{ + unw_word_t *addr; + ucontext_t *uc = arg; + + if (unw_is_fpreg (reg)) + goto badreg; + + Debug (16, "reg = %s\n", unw_regname (reg)); + if (!(addr = uc_addr (uc, reg))) + goto badreg; + + if (write) + { + *(unw_word_t *) (intptr_t) addr = (sw_64_reg_t) *val; + Debug (12, "%s <- %llx\n", unw_regname (reg), (long long) *val); + } + else + { + *val = (sw_64_reg_t) *(unw_word_t *) (intptr_t) addr; + Debug (12, "%s -> %llx\n", unw_regname (reg), (long long) *val); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} + +static int +access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val, + int write, void *arg) +{ + ucontext_t *uc = arg; + unw_fpreg_t *addr; + + if (!unw_is_fpreg (reg)) + goto badreg; + + if (!(addr = uc_addr (uc, reg))) + goto badreg; + + if (write) + { + Debug (12, "%s <- %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + *(unw_fpreg_t *) (intptr_t) addr = *val; + } + else + { + *val = *(unw_fpreg_t *) (intptr_t) addr; + Debug (12, "%s -> %08lx.%08lx.%08lx\n", unw_regname (reg), + ((long *)val)[0], ((long *)val)[1], ((long *)val)[2]); + } + return 0; + + badreg: + Debug (1, "bad register number %u\n", reg); + /* attempt to access a non-preserved register */ + return -UNW_EBADREG; +} + +static int +get_static_proc_name (unw_addr_space_t as, unw_word_t ip, + char *buf, size_t buf_len, unw_word_t *offp, + void *arg) +{ + + return elf_w (get_proc_name) (as, getpid (), ip, buf, buf_len, offp); +} + +HIDDEN void +sw_64_local_addr_space_init (void) +{ + memset (&local_addr_space, 0, sizeof (local_addr_space)); + local_addr_space.big_endian = (__BYTE_ORDER == __BIG_ENDIAN); + local_addr_space.abi = UNW_SW_64_ABI_N64; + local_addr_space.addr_size = sizeof (void *); + local_addr_space.caching_policy = UNWI_DEFAULT_CACHING_POLICY; + local_addr_space.acc.find_proc_info = dwarf_find_proc_info; + local_addr_space.acc.put_unwind_info = put_unwind_info; + local_addr_space.acc.get_dyn_info_list_addr = get_dyn_info_list_addr; + local_addr_space.acc.access_mem = access_mem; + local_addr_space.acc.access_reg = access_reg; + local_addr_space.acc.access_fpreg = access_fpreg; + local_addr_space.acc.resume = sw_64_local_resume; /* sw_64_local_resume? FIXME! */ + local_addr_space.acc.get_proc_name = get_static_proc_name; + unw_flush_cache (&local_addr_space, 0, 0); +} + +#endif /* !UNW_REMOTE_ONLY */ diff -Nuar libunwind-1.5.0.org/src/sw_64/Ginit_local.c libunwind-1.5.0.sw/src/sw_64/Ginit_local.c --- libunwind-1.5.0.org/src/sw_64/Ginit_local.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Ginit_local.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,76 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" +#include "init.h" + +#ifdef UNW_REMOTE_ONLY + +int +unw_init_local (unw_cursor_t *cursor, ucontext_t *uc) +{ + return -UNW_EINVAL; +} + +#else /* !UNW_REMOTE_ONLY */ + +static int +unw_init_local_common(unw_cursor_t *cursor, ucontext_t *uc, unsigned use_prev_instr) +{ + struct cursor *c = (struct cursor *) cursor; + + if (!tdep_init_done) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = unw_local_addr_space; + c->dwarf.as_arg = uc; + return common_init (c, use_prev_instr); +} + +int +unw_init_local(unw_cursor_t *cursor, ucontext_t *uc) +{ + return unw_init_local_common(cursor, uc, 1); +} + +int +unw_init_local2 (unw_cursor_t *cursor, ucontext_t *uc, int flag) +{ + if (!flag) + { + return unw_init_local_common(cursor, uc, 1); + } + else if (flag == UNW_INIT_SIGNAL_FRAME) + { + return unw_init_local_common(cursor, uc, 0); + } + else + { + return -UNW_EINVAL; + } +} + +#endif /* !UNW_REMOTE_ONLY */ diff -Nuar libunwind-1.5.0.org/src/sw_64/Ginit_remote.c libunwind-1.5.0.sw/src/sw_64/Ginit_remote.c --- libunwind-1.5.0.org/src/sw_64/Ginit_remote.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Ginit_remote.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,45 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "init.h" +#include "unwind_i.h" + +int +unw_init_remote (unw_cursor_t *cursor, unw_addr_space_t as, void *as_arg) +{ +#ifdef UNW_LOCAL_ONLY + return -UNW_EINVAL; +#else /* !UNW_LOCAL_ONLY */ + struct cursor *c = (struct cursor *) cursor; + + if (!tdep_init_done) + tdep_init (); + + Debug (1, "(cursor=%p)\n", c); + + c->dwarf.as = as; + c->dwarf.as_arg = as_arg; + return common_init (c, 0); +#endif /* !UNW_LOCAL_ONLY */ +} diff -Nuar libunwind-1.5.0.org/src/sw_64/Gis_signal_frame.c libunwind-1.5.0.sw/src/sw_64/Gis_signal_frame.c --- libunwind-1.5.0.org/src/sw_64/Gis_signal_frame.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gis_signal_frame.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,116 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" +#include "offsets.h" +#include <stdio.h> + + +int +unw_is_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w1, ip; + unw_addr_space_t as; + unw_accessors_t *a; + void *arg; + int ret; + + as = c->dwarf.as; + a = unw_get_accessors_int (as); + arg = c->dwarf.as_arg; + + ip = c->dwarf.ip; + + /* syscall */ + if ((ret = (*a->access_mem) (as, ip + 4, &w1, 0, arg)) < 0) + return 0; + + if ( w1 == 0x2000083f81f0067UL) + c->sigcontext_format = SW_SCF_LINUX_SIGFRAME; + else{ + if ( w1 == 0x2000083f81f015fUL) + c->sigcontext_format = SW_SCF_LINUX_RT_SIGFRAME; + else + c->sigcontext_format = SW_SCF_NONE; + } + return c->sigcontext_format > SW_SCF_NONE; + + //return -UNW_ENOINFO; +} +#if 0 +int +unw_handle_signal_frame (unw_cursor_t *cursor) +{ + int i; + struct cursor *c = (struct cursor *) cursor; + unw_word_t sc_addr, sp, sp_addr = c->dwarf.cfa; + struct dwarf_loc sp_loc = DWARF_LOC (sp_addr, 0); + int ret; + + if ((ret = dwarf_get (&c->dwarf, sp_loc, &sp)) < 0) + return -UNW_EUNSPEC; + + + /* Save the SP and PC to be able to return execution at this point + later in time (unw_resume). */ + c->sigcontext_sp = c->dwarf.cfa; + c->sigcontext_pc = c->dwarf.ip; + if ( c->sigcontext_format == SW_SCF_LINUX_RT_SIGFRAME) + { + c->ucontext_addr = sp_addr + sizeof (siginfo_t); + c->sigcontext_addr = sp_addr + sizeof (siginfo_t) + 48; + } + else + { + c->ucontext_addr = 0; + c->sigcontext_addr = sp_addr; + } + sc_addr = c->sigcontext_addr + 16; + c->dwarf.loc[UNW_SW_64_PC] = DWARF_LOC (sc_addr, 0); + + /* Update the dwarf cursor. + Set the location of the registers to the corresponding addresses */ + + sc_addr = c->sigcontext_addr + 32; + +#define SC_REG_OFFSET(X) (8 * X) + + for (i = UNW_SW_64_R0; i <= UNW_SW_64_R31; i++) + { + c->dwarf.loc[i] = DWARF_LOC (sc_addr + SC_REG_OFFSET(i), 0); + } + sc_addr += sizeof(long); //sc_fpregs + + for (i = UNW_SW_64_F0; i < UNW_SW_64_PC; i++) + { + c->dwarf.loc[i] = DWARF_LOC (sc_addr + SC_REG_OFFSET(i), 0); + } + + dwarf_get (&c->dwarf, c->dwarf.loc[UNW_SW_64_R30], &c->dwarf.cfa); + dwarf_get (&c->dwarf, c->dwarf.loc[UNW_SW_64_PC], &c->dwarf.ip); + + return 1; +} +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Greg_states_iterate.c libunwind-1.5.0.sw/src/sw_64/Greg_states_iterate.c --- libunwind-1.5.0.org/src/sw_64/Greg_states_iterate.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Greg_states_iterate.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,37 @@ +/* libunwind - a platform-independent unwind library + Copyright (c) 2002-2003 Hewlett-Packard Development Company, L.P. + Contributed by David Mosberger-Tang <davidm@hpl.hp.com> + + Modified for x86_64 by Max Asbock <masbock@us.ibm.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. */ + +#include "unwind_i.h" + +int +unw_reg_states_iterate (unw_cursor_t *cursor, + unw_reg_states_callback cb, void *token) +{ + struct cursor *c = (struct cursor *) cursor; + + return dwarf_reg_states_iterate (&c->dwarf, cb, token); +} diff -Nuar libunwind-1.5.0.org/src/sw_64/Gregs.c libunwind-1.5.0.sw/src/sw_64/Gregs.c --- libunwind-1.5.0.org/src/sw_64/Gregs.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gregs.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,131 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" + +/* FIXME: The following is probably unfinished and/or at least partly bogus. */ + +HIDDEN int +tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp, + int write) +{ + dwarf_loc_t loc = DWARF_NULL_LOC; + + switch (reg) + { + case UNW_SW_64_R0: + case UNW_SW_64_R1: + case UNW_SW_64_R2: + case UNW_SW_64_R3: + case UNW_SW_64_R4: + case UNW_SW_64_R5: + case UNW_SW_64_R6: + case UNW_SW_64_R7: + case UNW_SW_64_R8: + case UNW_SW_64_R9: + case UNW_SW_64_R10: + case UNW_SW_64_R11: + case UNW_SW_64_R12: + case UNW_SW_64_R13: + case UNW_SW_64_R14: + case UNW_SW_64_R15: + case UNW_SW_64_R16: + case UNW_SW_64_R17: + case UNW_SW_64_R18: + case UNW_SW_64_R19: + case UNW_SW_64_R20: + case UNW_SW_64_R21: + case UNW_SW_64_R22: + case UNW_SW_64_R23: + case UNW_SW_64_R24: + case UNW_SW_64_R25: + case UNW_SW_64_R26: + case UNW_SW_64_R27: + case UNW_SW_64_R28: + case UNW_SW_64_R29: + case UNW_SW_64_R30: + case UNW_SW_64_R31: + loc = c->dwarf.loc[reg - UNW_SW_64_R0]; + break; +#ifndef LIJM + case UNW_SW_64_PC: + if (!write) + { + *valp = c->dwarf.ip; + return 0; + } + loc = c->dwarf.loc[reg - UNW_SW_64_R0]; + break; + + default: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; + } + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + dwarf_loc_t loc = DWARF_NULL_LOC; + if (reg >= UNW_SW_64_F0 && reg <= UNW_SW_64_FPCR ) + loc = c->dwarf.loc[reg - UNW_SW_64_R0]; + if (write) + return dwarf_putfp (&c->dwarf, loc, *valp); + else + return dwarf_getfp (&c->dwarf, loc, valp); +} +#else + case UNW_SW_64_PC: + if (write) + c->dwarf.ip = *valp; /* update the IP cache */ + loc = c->dwarf.loc[reg]; + break; + + default: + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; + } + + if (write) + return dwarf_put (&c->dwarf, loc, *valp); + else + return dwarf_get (&c->dwarf, loc, valp); +} + +/* FIXME for SW_64. */ + +HIDDEN int +tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp, + int write) +{ + Debug (1, "bad register number %u\n", reg); + return -UNW_EBADREG; +} +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Gresume.c libunwind-1.5.0.sw/src/sw_64/Gresume.c --- libunwind-1.5.0.org/src/sw_64/Gresume.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gresume.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,112 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + + +#include <stdlib.h> + +#include "unwind_i.h" + +#ifndef UNW_REMOTE_ONLY + +HIDDEN inline int +sw_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg) +{ + struct cursor *c = (struct cursor *) cursor; + ucontext_t *uc = (ucontext_t *)c->dwarf.as_arg; + + /* Ensure c->pi is up-to-date. On sw_64, it's relatively common to be + missing DWARF unwind info. We don't want to fail in that case, + because the frame-chain still would let us do a backtrace at + least. */ + dwarf_make_proc_info (&c->dwarf); + + if (unlikely (c->sigcontext_format != SW_SCF_NONE)) + { + struct sigcontext *sc = (struct sigcontext *) c->sigcontext_addr; + + Debug (8, "resuming at ip=%#lx cfa=%#lx via sigreturn(%p)\n", + c->dwarf.ip, c->dwarf.cfa, sc); + sigreturn (sc); + } + else + { + Debug (8, "resuming at ip=%#lx cfa=%#lx sp= %#lx via setcontext()\n", + c->dwarf.ip, c->dwarf.cfa, uc->uc_mcontext.sc_regs[30]); + setcontext (uc); + } + return -UNW_EINVAL; +} + +#endif /* !UNW_REMOTE_ONLY */ + +static inline int +establish_machine_state (struct cursor *c) +{ + int (*access_reg) (unw_addr_space_t, unw_regnum_t, unw_word_t *, + int write, void *); + int (*access_fpreg) (unw_addr_space_t, unw_regnum_t, unw_fpreg_t *, + int write, void *); + unw_addr_space_t as = c->dwarf.as; + void *arg = c->dwarf.as_arg; + unw_fpreg_t fpval; + unw_word_t val; + int reg; + + access_reg = as->acc.access_reg; + access_fpreg = as->acc.access_fpreg; + + Debug (8, "copying out cursor state\n"); + + for (reg = 0; reg <= UNW_SW_64_PC; ++reg) + { + Debug (16, "copying %s %d\n", unw_regname (reg), reg); + if (unw_is_fpreg (reg)) + { + if (tdep_access_fpreg (c, reg, &fpval, 0) >= 0) + (*access_fpreg) (as, reg, &fpval, 1, arg); + } + else + { + if (tdep_access_reg (c, reg, &val, 0) >= 0) + (*access_reg) (as, reg, &val, 1, arg); + } + } + (*access_reg) (as, UNW_SW_64_R30, &c->dwarf.cfa, 1, arg); + return 0; +} + +int +unw_resume (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + Debug (1, "(cursor=%p)\n", c); + + if ((ret = establish_machine_state (c)) < 0) + return ret; + + return (*c->dwarf.as->acc.resume) (c->dwarf.as, (unw_cursor_t *) c, + c->dwarf.as_arg); +} diff -Nuar libunwind-1.5.0.org/src/sw_64/Gstep.c libunwind-1.5.0.sw/src/sw_64/Gstep.c --- libunwind-1.5.0.org/src/sw_64/Gstep.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Gstep.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,349 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2015 Imagination Technologies Limited + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" +#include "offsets.h" + +static int +sw_64_handle_signal_frame (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + unw_word_t sc_addr, sp_addr = c->dwarf.cfa; + unw_word_t ra, fp; + int ret; + + switch (unw_is_signal_frame (cursor)) { + case 1: + sc_addr = sp_addr + LINUX_SF_TRAMP_SIZE + sizeof (siginfo_t) + + LINUX_UC_MCONTEXT_OFF; + break; + case 2: + sc_addr = sp_addr + LINUX_UC_MCONTEXT_OFF; + break; + default: + return -UNW_EUNSPEC; + } + + if (tdep_big_endian(c->dwarf.as)) + sc_addr += 4; + + c->sigcontext_addr = sc_addr; + + /* Update the dwarf cursor. */ + c->dwarf.loc[UNW_SW_64_R0] = DWARF_LOC (sc_addr + LINUX_SC_R0_OFF, 0); + c->dwarf.loc[UNW_SW_64_R1] = DWARF_LOC (sc_addr + LINUX_SC_R1_OFF, 0); + c->dwarf.loc[UNW_SW_64_R2] = DWARF_LOC (sc_addr + LINUX_SC_R2_OFF, 0); + c->dwarf.loc[UNW_SW_64_R3] = DWARF_LOC (sc_addr + LINUX_SC_R3_OFF, 0); + c->dwarf.loc[UNW_SW_64_R4] = DWARF_LOC (sc_addr + LINUX_SC_R4_OFF, 0); + c->dwarf.loc[UNW_SW_64_R5] = DWARF_LOC (sc_addr + LINUX_SC_R5_OFF, 0); + c->dwarf.loc[UNW_SW_64_R6] = DWARF_LOC (sc_addr + LINUX_SC_R6_OFF, 0); + c->dwarf.loc[UNW_SW_64_R7] = DWARF_LOC (sc_addr + LINUX_SC_R7_OFF, 0); + c->dwarf.loc[UNW_SW_64_R8] = DWARF_LOC (sc_addr + LINUX_SC_R8_OFF, 0); + c->dwarf.loc[UNW_SW_64_R9] = DWARF_LOC (sc_addr + LINUX_SC_R9_OFF, 0); + c->dwarf.loc[UNW_SW_64_R10] = DWARF_LOC (sc_addr + LINUX_SC_R10_OFF, 0); + c->dwarf.loc[UNW_SW_64_R11] = DWARF_LOC (sc_addr + LINUX_SC_R11_OFF, 0); + c->dwarf.loc[UNW_SW_64_R12] = DWARF_LOC (sc_addr + LINUX_SC_R12_OFF, 0); + c->dwarf.loc[UNW_SW_64_R13] = DWARF_LOC (sc_addr + LINUX_SC_R13_OFF, 0); + c->dwarf.loc[UNW_SW_64_R14] = DWARF_LOC (sc_addr + LINUX_SC_R14_OFF, 0); + c->dwarf.loc[UNW_SW_64_R15] = DWARF_LOC (sc_addr + LINUX_SC_R15_OFF, 0); + c->dwarf.loc[UNW_SW_64_R16] = DWARF_LOC (sc_addr + LINUX_SC_R16_OFF, 0); + c->dwarf.loc[UNW_SW_64_R17] = DWARF_LOC (sc_addr + LINUX_SC_R17_OFF, 0); + c->dwarf.loc[UNW_SW_64_R18] = DWARF_LOC (sc_addr + LINUX_SC_R18_OFF, 0); + c->dwarf.loc[UNW_SW_64_R19] = DWARF_LOC (sc_addr + LINUX_SC_R19_OFF, 0); + c->dwarf.loc[UNW_SW_64_R20] = DWARF_LOC (sc_addr + LINUX_SC_R20_OFF, 0); + c->dwarf.loc[UNW_SW_64_R21] = DWARF_LOC (sc_addr + LINUX_SC_R21_OFF, 0); + c->dwarf.loc[UNW_SW_64_R22] = DWARF_LOC (sc_addr + LINUX_SC_R22_OFF, 0); + c->dwarf.loc[UNW_SW_64_R23] = DWARF_LOC (sc_addr + LINUX_SC_R23_OFF, 0); + c->dwarf.loc[UNW_SW_64_R24] = DWARF_LOC (sc_addr + LINUX_SC_R24_OFF, 0); + c->dwarf.loc[UNW_SW_64_R25] = DWARF_LOC (sc_addr + LINUX_SC_R25_OFF, 0); + c->dwarf.loc[UNW_SW_64_R26] = DWARF_LOC (sc_addr + LINUX_SC_R26_OFF, 0); + c->dwarf.loc[UNW_SW_64_R27] = DWARF_LOC (sc_addr + LINUX_SC_R27_OFF, 0); + c->dwarf.loc[UNW_SW_64_R28] = DWARF_LOC (sc_addr + LINUX_SC_R28_OFF, 0); + c->dwarf.loc[UNW_SW_64_R29] = DWARF_LOC (sc_addr + LINUX_SC_R29_OFF, 0); + c->dwarf.loc[UNW_SW_64_R30] = DWARF_LOC (sc_addr + LINUX_SC_R30_OFF, 0); + c->dwarf.loc[UNW_SW_64_R31] = DWARF_LOC (sc_addr + LINUX_SC_R31_OFF, 0); + c->dwarf.loc[UNW_SW_64_PC] = DWARF_LOC (sc_addr + LINUX_SC_PC_OFF, 0); + + /* Set SP/CFA and PC/IP. */ + dwarf_get (&c->dwarf, c->dwarf.loc[UNW_SW_64_R30], &c->dwarf.cfa); + + if ((ret = dwarf_get(&c->dwarf, DWARF_LOC(sc_addr + LINUX_SC_PC_OFF, 0), + &c->dwarf.ip)) < 0) + return ret; + + if ((ret = dwarf_get(&c->dwarf, DWARF_LOC(sc_addr + LINUX_SC_R26_OFF, 0), + &ra)) < 0) + return ret; + if ((ret = dwarf_get(&c->dwarf, DWARF_LOC(sc_addr + LINUX_SC_R15_OFF, 0), + &fp)) < 0) + return ret; + + Debug (2, "SH (ip=0x%016llx, ra=0x%016llx, sp=0x%016llx, fp=0x%016llx)\n", + (unsigned long long)c->dwarf.ip, (unsigned long long)ra, + (unsigned long long)c->dwarf.cfa, (unsigned long long)fp); + + c->dwarf.pi_valid = 0; + c->dwarf.use_prev_instr = 0; + + return 1; +} + + +static inline +int is_valid_fp_val(unw_word_t cfa_val, unw_word_t fp_val) +{ + return fp_val > 0 && cfa_val > 0 && fp_val >cfa_val && (fp_val - cfa_val < 0x4000); +} + +static int _step_n64(struct cursor *c) +{ + #define FP_REG UNW_SW_64_R15 + #define SP_REG UNW_SW_64_R30 + #define RA_REG UNW_SW_64_R26 + + //TODO:handle plt entry + int ret; + unw_word_t current_fp_val = 0; + unw_word_t current_ra_val = 0; + unw_word_t current_sp_val = 0; + struct dwarf_loc up_fp_loc = DWARF_NULL_LOC; + struct dwarf_loc up_ra_loc = DWARF_NULL_LOC; + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[SP_REG], ¤t_sp_val); + if (ret < 0) + { + Debug (2, "returning %d [SP=0x%lx]\n", ret, + DWARF_GET_LOC (c->dwarf.loc[FP_REG])); + return ret; + } + ret = dwarf_get (&c->dwarf, c->dwarf.loc[FP_REG], ¤t_fp_val); + if (ret < 0) + { + Debug (2, "returning %d [FP=0x%lx]\n", ret, + DWARF_GET_LOC (c->dwarf.loc[FP_REG])); + return ret; + } + ret = dwarf_get (&c->dwarf, c->dwarf.loc[RA_REG], ¤t_ra_val); + if (ret < 0) + { + Debug (2, "returning %d [RA=0x%lx]\n", ret, + DWARF_GET_LOC (c->dwarf.loc[RA_REG])); + return ret; + } + + Debug(2, "BEGIN GUESSING WITH SP:%p FP:%p CFA:%p at %p, RA:%p\n", + current_sp_val, current_fp_val, c->dwarf.cfa, + c->dwarf.ip, current_ra_val + ); + + if (current_fp_val == current_sp_val) { + // Don't adjust FP + up_fp_loc = c->dwarf.loc[FP_REG]; + up_ra_loc = c->dwarf.loc[RA_REG]; + } else if (is_valid_fp_val(c->dwarf.cfa, current_fp_val)) { + /* Heuristic to determine incorrect guess. For FP to be a + valid frame it needs to be above current CFA, but don't + let it go more than a little. Note that we can't deduce + anything about new FP (fp1) since it may not be a frame + pointer in the frame above. Just check we get the value. */ + up_fp_loc = DWARF_MEM_LOC (c, current_fp_val+16); + up_ra_loc = DWARF_MEM_LOC (c, current_fp_val+24); + unw_word_t up_fp_val = 0; + ret = dwarf_get (&c->dwarf, up_fp_loc, &up_fp_val); + if (ret > 0 && is_valid_fp_val(current_fp_val, up_fp_val)) { + c->dwarf.loc[FP_REG] = up_fp_loc; + } + } + + if (DWARF_IS_NULL_LOC (up_fp_loc)) + { + ret = 0; + Debug (2, "NULL %%fp loc, returning %d\n", ret); + return ret; + } + + c->dwarf.loc[UNW_SW_64_PC] = c->dwarf.loc[RA_REG]; + c->dwarf.loc[RA_REG] = up_ra_loc; + c->dwarf.loc[SP_REG] = up_fp_loc; + c->dwarf.loc[FP_REG] = up_fp_loc; + c->dwarf.use_prev_instr = 1; + + if (c->dwarf.ip == current_ra_val && current_fp_val == current_sp_val) { + // Backtrace stopped: frame did not save the PC + c->dwarf.ip = 0; + } else { + c->dwarf.ip = current_ra_val; + } + return (c->dwarf.ip == 0) ? 0 : 1; +} + + +#ifdef XWB20210316 +static int +my_step(unw_cursor_t *cursor, int ret) +{ + int i, w1; + unw_proc_info_t pi; + struct dwarf_loc loc; + struct cursor *c = (struct cursor *) cursor; + unw_word_t pc, ip, w0, min; + unw_addr_space_t as = tdep_get_as (c); + unw_accessors_t *a; + unsigned int frame_size,stack_offp[2]; + void *arg; +#define EIP UNW_SW_64_PC + /* DWARF failed, let's see if we can follow the frame-chain + * */ + + ip = tdep_get_ip (c);//c->dwarf.ip; + a = unw_get_accessors (as); + arg = tdep_get_as_arg (c);//c->dwarf.as_arg; + + if ((ret = unw_get_proc_info(cursor,&pi))<0) + { + Debug (13, "get_proc_info returning %d, ip=%#lx, start %#lx\n", ret, ip, pi.start_ip); + c->dwarf.ip = 0; + return ret; + } + Debug (2, "pc: %#lx, start_ip %#lx, end_ip%#lx\n", ip, + pi.start_ip, pi.end_ip); + + stack_offp[0] = 0; + stack_offp[1] = 0; + frame_size = 0; + w0 = pi.start_ip+ (20<<4); + min = (w0<ip)?w0:ip; + for (pc = pi.start_ip+8;pc <= min; pc+=4) + { + if ((ret = (*a->access_mem) (as, pc, &w0, 0, arg)) < 0) + return ret; + + w1 = w0 & 0xffff8000U; + if (w1 == 0xfbde8000U) + { + if (frame_size == 0) + { + w1 = w0 &0xffffU; + frame_size = (-w1) & 0xffff; + } + } + else + if (w1== 0xaf5e0000U) + { + if (stack_offp[0] == 0) + stack_offp[0] = (w0 & 0xffff) ; + } + else + if (w1== 0xadfe0000U) + { + if (stack_offp[1] == 0) + stack_offp[1] = (w0 & 0xffff) ; + } + } + + Debug (13, "frame_size %d, stack_offp %d, %d\n", frame_size, + stack_offp[0],stack_offp[1]); + + if (stack_offp[1]) + c->dwarf.loc[UNW_SW_64_R15] = DWARF_LOC (c->dwarf.cfa+stack_offp[1],0); + loc = DWARF_LOC (c->dwarf.cfa+stack_offp[0],0); + + if (!DWARF_IS_NULL_LOC(loc)) + { + ret = dwarf_get (&c->dwarf,loc,&c->dwarf.ip); + if (ret < 0) + { + Debug(13,"dwarf_get([EIP=0x%lx]) failed\n", DWARF_GET_LOC (loc)); + Debug (2, "returning %d\n", ret); + return ret; + } + else + { + Debug (13, "[EIP=0x%lx] = 0x%lx\n", DWARF_GET_LOC (loc), c->dwarf.ip); + c->dwarf.cfa += frame_size; + } + } + else + c->dwarf.ip = 0; + + ret = (c->dwarf.ip == 0) ? 0 : 1; + Debug (1, "returning %d\n", ret); + return ret; +} +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + unw_word_t w0; + struct dwarf_loc loc; + int i, ret; + + Debug (0, "(cursor=%p),ip=0x%016lx, cfa=0x%016lx)\n", + c, c->dwarf.ip, c->dwarf.cfa); + + if (unw_is_signal_frame(cursor)) + { + ret = unw_handle_signal_frame(cursor); + if (ret == -UNW_ENOINFO) + Debug (1, "unw_is_signal_frame error\n"); + return ret; + } + + ret = dwarf_step (&c->dwarf); + if (unlikely (ret == -UNW_ESTOPUNWIND)) + { + Debug (1, "dwarf_step STOPUNWIND\n"); + return ret; + } + /* Dwarf unwinding didn't work, stop. */ + if (unlikely (ret < 0)) + my_step(c,ret); + ret = (c->dwarf.ip == 0) ? 0 : 1; + Debug (1, "returning %d\n", ret); + return ret; +} +#else +int +unw_step (unw_cursor_t *cursor) +{ + struct cursor *c = (struct cursor *) cursor; + int ret; + + ret = sw_64_handle_signal_frame (cursor); + if (ret < 0) + /* Not a signal frame, try DWARF-based unwinding. */ + ret = dwarf_step (&c->dwarf); + + if (unlikely (ret == -UNW_ESTOPUNWIND)) + return ret; + +#if _SW_64_SIM == _ABI64 + if (unlikely (ret < 0)) + { + return _step_n64(c); + } +#endif + return (c->dwarf.ip == 0) ? 0 : 1; +} +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lapply_reg_state.c libunwind-1.5.0.sw/src/sw_64/Lapply_reg_state.c --- libunwind-1.5.0.org/src/sw_64/Lapply_reg_state.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lapply_reg_state.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gapply_reg_state.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lcreate_addr_space.c libunwind-1.5.0.sw/src/sw_64/Lcreate_addr_space.c --- libunwind-1.5.0.org/src/sw_64/Lcreate_addr_space.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lcreate_addr_space.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gcreate_addr_space.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lget_proc_info.c libunwind-1.5.0.sw/src/sw_64/Lget_proc_info.c --- libunwind-1.5.0.org/src/sw_64/Lget_proc_info.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lget_proc_info.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_proc_info.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lget_save_loc.c libunwind-1.5.0.sw/src/sw_64/Lget_save_loc.c --- libunwind-1.5.0.org/src/sw_64/Lget_save_loc.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lget_save_loc.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gget_save_loc.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lglobal.c libunwind-1.5.0.sw/src/sw_64/Lglobal.c --- libunwind-1.5.0.org/src/sw_64/Lglobal.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lglobal.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gglobal.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Linit.c libunwind-1.5.0.sw/src/sw_64/Linit.c --- libunwind-1.5.0.org/src/sw_64/Linit.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Linit.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Linit_local.c libunwind-1.5.0.sw/src/sw_64/Linit_local.c --- libunwind-1.5.0.org/src/sw_64/Linit_local.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Linit_local.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_local.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Linit_remote.c libunwind-1.5.0.sw/src/sw_64/Linit_remote.c --- libunwind-1.5.0.org/src/sw_64/Linit_remote.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Linit_remote.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Ginit_remote.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lis_signal_frame.c libunwind-1.5.0.sw/src/sw_64/Lis_signal_frame.c --- libunwind-1.5.0.org/src/sw_64/Lis_signal_frame.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lis_signal_frame.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gis_signal_frame.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lreg_states_iterate.c libunwind-1.5.0.sw/src/sw_64/Lreg_states_iterate.c --- libunwind-1.5.0.org/src/sw_64/Lreg_states_iterate.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lreg_states_iterate.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Greg_states_iterate.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lregs.c libunwind-1.5.0.sw/src/sw_64/Lregs.c --- libunwind-1.5.0.org/src/sw_64/Lregs.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lregs.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gregs.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lresume.c libunwind-1.5.0.sw/src/sw_64/Lresume.c --- libunwind-1.5.0.org/src/sw_64/Lresume.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lresume.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gresume.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/Lstep.c libunwind-1.5.0.sw/src/sw_64/Lstep.c --- libunwind-1.5.0.org/src/sw_64/Lstep.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/Lstep.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,5 @@ +#define UNW_LOCAL_ONLY +#include <libunwind.h> +#if defined(UNW_LOCAL_ONLY) && !defined(UNW_REMOTE_ONLY) +#include "Gstep.c" +#endif diff -Nuar libunwind-1.5.0.org/src/sw_64/getcontext.S libunwind-1.5.0.sw/src/sw_64/getcontext.S --- libunwind-1.5.0.org/src/sw_64/getcontext.S 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/getcontext.S 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,77 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + Copyright (C) 2012 Tommi Rantala <tt.rantala@gmail.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. */ + +#include "offsets.h" +#include <endian.h> + + .text +#define OFFSET 80 + .global _Usw_64_getcontext + .type _Usw_64_getcontext, %function + .ent _Usw_64_getcontext + # This is a stub version of getcontext() for SW_64 which only stores core + # registers. +_Usw_64_getcontext: + .set noat + stl $0, (0 + OFFSET)($16) + stl $1, (8 + OFFSET)($16) + stl $2, (16 + OFFSET)($16) + stl $3, (24 + OFFSET)($16) + stl $4, (32 + OFFSET)($16) + stl $5, (40 + OFFSET)($16) + stl $6, (48 + OFFSET)($16) + stl $7, (56 + OFFSET)($16) + stl $8, (64 + OFFSET)($16) + stl $9, (72 + OFFSET)($16) + stl $10, (80 + OFFSET)($16) + stl $11, (88 + OFFSET)($16) + stl $12, (96 + OFFSET)($16) + stl $13, (104 + OFFSET)($16) + stl $14, (112 + OFFSET)($16) + stl $15, (120 + OFFSET)($16) + stl $16, (128 + OFFSET)($16) + stl $17, (136 + OFFSET)($16) + stl $18, (144 + OFFSET)($16) + stl $19, (152 + OFFSET)($16) + stl $20, (160 + OFFSET)($16) + stl $21, (168 + OFFSET)($16) + stl $22, (176 + OFFSET)($16) + stl $23, (184 + OFFSET)($16) + stl $24, (192 + OFFSET)($16) + stl $25, (200 + OFFSET)($16) + stl $26, (208 + OFFSET)($16) + stl $27, (216 + OFFSET)($16) + stl $28, (224 + OFFSET)($16) + stl $29, (232 + OFFSET)($16) + stl $30, (240 + OFFSET)($16) + stl $31, (248 + OFFSET)($16) +# br $0,2f +2: +# stl $0, (OFFSET-16)($16) + stl $26, (OFFSET-16)($16) + ldl $0, (0 + OFFSET)($16) + ret + .end _Usw_64_getcontext + .size _Usw_64_getcontext, .-_Usw_64_getcontext diff -Nuar libunwind-1.5.0.org/src/sw_64/init.h libunwind-1.5.0.sw/src/sw_64/init.h --- libunwind-1.5.0.org/src/sw_64/init.h 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/init.h 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,59 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" + +static inline int +common_init (struct cursor *c, unsigned use_prev_instr) +{ + int ret, i; + + for (i = 0; i < 32; i++) + c->dwarf.loc[i] = DWARF_REG_LOC (&c->dwarf, UNW_SW_64_R0 + i); + for (i = 32; i < DWARF_NUM_PRESERVED_REGS; ++i) + c->dwarf.loc[i] = DWARF_NULL_LOC; + + c->dwarf.loc[UNW_SW_64_PC] = DWARF_REG_LOC (&c->dwarf, UNW_SW_64_PC); + + ret = dwarf_get (&c->dwarf, c->dwarf.loc[UNW_SW_64_PC], &c->dwarf.ip); + if (ret < 0) + return ret; + + ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_SW_64_R30), + &c->dwarf.cfa); + if (ret < 0) + return ret; + + /* FIXME: Initialisation for other registers. */ + + c->dwarf.args_size = 0; + c->dwarf.stash_frames = 0; + c->dwarf.use_prev_instr = use_prev_instr; + c->dwarf.pi_valid = 0; + c->dwarf.pi_is_dynamic = 0; + c->dwarf.hint = 0; + c->dwarf.prev_rs = 0; + + return 0; +} diff -Nuar libunwind-1.5.0.org/src/sw_64/is_fpreg.c libunwind-1.5.0.sw/src/sw_64/is_fpreg.c --- libunwind-1.5.0.org/src/sw_64/is_fpreg.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/is_fpreg.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,37 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "libunwind_i.h" + +/* FIXME: I'm not sure if libunwind's GP/FP register distinction is very useful + on SW_64. */ + +int +unw_is_fpreg (int regnum) +{ + /* FIXME: Support FP. */ + if (regnum >= UNW_SW_64_F0 && regnum < UNW_SW_64_PC) + return 1; + return 0; +} diff -Nuar libunwind-1.5.0.org/src/sw_64/offsets.h libunwind-1.5.0.sw/src/sw_64/offsets.h --- libunwind-1.5.0.org/src/sw_64/offsets.h 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/offsets.h 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,86 @@ +/* Linux-specific definitions: */ + +/* Define various structure offsets to simplify cross-compilation. */ + +/* FIXME: Currently these are only used in getcontext.S, which is only used + for a local unwinder, so we can use the compile-time ABI. At a later date + we will want all three here, to use for signal handlers. Also, because + of the three ABIs, gen-offsets.c can not quite generate this file. */ + +/* Offsets for SW_64 Linux "ucontext_t": */ + +/* First 24 bytes in sigframe are argument save space and padding for +what used to be signal trampolines. Ref: arch/sw_64/kernel/signal.c */ +#define LINUX_SF_TRAMP_SIZE 0x18 + +#if _SW_64_SIM == _ABIO32 + +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x4 +# define LINUX_UC_STACK_OFF 0x8 +# define LINUX_UC_MCONTEXT_OFF 0x18 +# define LINUX_UC_SIGMASK_OFF 0x268 +# define LINUX_UC_MCONTEXT_PC 0x20 +# define LINUX_UC_MCONTEXT_GREGS 0x28 + +#elif _SW_64_SIM == _ABIN32 + +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x4 +# define LINUX_UC_STACK_OFF 0x8 +# define LINUX_UC_MCONTEXT_OFF 0x18 +# define LINUX_UC_SIGMASK_OFF 0x270 +# define LINUX_UC_MCONTEXT_PC 0x258 +# define LINUX_UC_MCONTEXT_GREGS 0x18 + +#elif _SW_64_SIM == _ABI64 + +# define LINUX_UC_FLAGS_OFF 0x0 +# define LINUX_UC_LINK_OFF 0x8 +# define LINUX_UC_STACK_OFF 0x10 +# define LINUX_UC_MCONTEXT_OFF 0x28 +# define LINUX_UC_SIGMASK_OFF 0x280 +# define LINUX_UC_MCONTEXT_PC 0x268 +# define LINUX_UC_MCONTEXT_GREGS 0x28 + +#else + +#error Unsupported ABI + +#endif + +#define LINUX_SC_R0_OFF (LINUX_UC_MCONTEXT_GREGS - LINUX_UC_MCONTEXT_OFF) +#define LINUX_SC_R1_OFF (LINUX_SC_R0_OFF + 1*8) +#define LINUX_SC_R2_OFF (LINUX_SC_R0_OFF + 2*8) +#define LINUX_SC_R3_OFF (LINUX_SC_R0_OFF + 3*8) +#define LINUX_SC_R4_OFF (LINUX_SC_R0_OFF + 4*8) +#define LINUX_SC_R5_OFF (LINUX_SC_R0_OFF + 5*8) +#define LINUX_SC_R6_OFF (LINUX_SC_R0_OFF + 6*8) +#define LINUX_SC_R7_OFF (LINUX_SC_R0_OFF + 7*8) +#define LINUX_SC_R8_OFF (LINUX_SC_R0_OFF + 8*8) +#define LINUX_SC_R9_OFF (LINUX_SC_R0_OFF + 9*8) +#define LINUX_SC_R10_OFF (LINUX_SC_R0_OFF + 10*8) +#define LINUX_SC_R11_OFF (LINUX_SC_R0_OFF + 11*8) +#define LINUX_SC_R12_OFF (LINUX_SC_R0_OFF + 12*8) +#define LINUX_SC_R13_OFF (LINUX_SC_R0_OFF + 13*8) +#define LINUX_SC_R14_OFF (LINUX_SC_R0_OFF + 14*8) +#define LINUX_SC_R15_OFF (LINUX_SC_R0_OFF + 15*8) +#define LINUX_SC_R16_OFF (LINUX_SC_R0_OFF + 16*8) +#define LINUX_SC_R17_OFF (LINUX_SC_R0_OFF + 17*8) +#define LINUX_SC_R18_OFF (LINUX_SC_R0_OFF + 18*8) +#define LINUX_SC_R19_OFF (LINUX_SC_R0_OFF + 19*8) +#define LINUX_SC_R20_OFF (LINUX_SC_R0_OFF + 20*8) +#define LINUX_SC_R21_OFF (LINUX_SC_R0_OFF + 21*8) +#define LINUX_SC_R22_OFF (LINUX_SC_R0_OFF + 22*8) +#define LINUX_SC_R23_OFF (LINUX_SC_R0_OFF + 23*8) +#define LINUX_SC_R24_OFF (LINUX_SC_R0_OFF + 24*8) +#define LINUX_SC_R25_OFF (LINUX_SC_R0_OFF + 25*8) +#define LINUX_SC_R26_OFF (LINUX_SC_R0_OFF + 26*8) +#define LINUX_SC_R27_OFF (LINUX_SC_R0_OFF + 27*8) +#define LINUX_SC_R28_OFF (LINUX_SC_R0_OFF + 28*8) +#define LINUX_SC_R29_OFF (LINUX_SC_R0_OFF + 29*8) +#define LINUX_SC_R30_OFF (LINUX_SC_R0_OFF + 30*8) +#define LINUX_SC_R31_OFF (LINUX_SC_R0_OFF + 31*8) + +#define LINUX_SC_SP_OFF LINUX_SC_R30_OFF +#define LINUX_SC_PC_OFF (LINUX_UC_MCONTEXT_PC - LINUX_UC_MCONTEXT_OFF) diff -Nuar libunwind-1.5.0.org/src/sw_64/regname.c libunwind-1.5.0.sw/src/sw_64/regname.c --- libunwind-1.5.0.org/src/sw_64/regname.c 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/regname.c 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,55 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#include "unwind_i.h" + +static const char *regname[] = + { + /* 0. */ + "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7", + /* 8. */ + "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15", + /* 16. */ + "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23", + /* 24. */ + "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31", + "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7", + /* 8. */ + "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15", + /* 16. */ + "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23", + /* 24. */ + "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31", + }; + +const char * +unw_regname (unw_regnum_t reg) +{ + if (reg < (unw_regnum_t) ARRAY_SIZE (regname)) + return regname[reg]; + else if (reg == UNW_SW_64_PC) + return "pc"; + else + return "???"; +} diff -Nuar libunwind-1.5.0.org/src/sw_64/siglongjmp.S libunwind-1.5.0.sw/src/sw_64/siglongjmp.S --- libunwind-1.5.0.org/src/sw_64/siglongjmp.S 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/siglongjmp.S 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,9 @@ + /* Dummy implementation for now. */ + + .globl _UI_siglongjmp_cont + .globl _UI_longjmp_cont + +_UI_siglongjmp_cont: +_UI_longjmp_cont: +# j $31 + ret diff -Nuar libunwind-1.5.0.org/src/sw_64/unwind_i.h libunwind-1.5.0.sw/src/sw_64/unwind_i.h --- libunwind-1.5.0.org/src/sw_64/unwind_i.h 1970-01-01 00:00:00.000000000 +0000 +++ libunwind-1.5.0.sw/src/sw_64/unwind_i.h 2022-03-16 09:18:39.000000000 +0000 @@ -0,0 +1,43 @@ +/* libunwind - a platform-independent unwind library + Copyright (C) 2008 CodeSourcery + +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. */ + +#ifndef unwind_i_h +#define unwind_i_h + +#include <stdint.h> + +#include <libunwind-sw_64.h> + +#include "libunwind_i.h" + +#define sw_64_lock UNW_OBJ(lock) +#define sw_64_local_resume UNW_OBJ(local_resume) +#define sw_64_local_addr_space_init UNW_OBJ(local_addr_space_init) + +extern int sw_64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, + void *arg); + +extern void sw_64_local_addr_space_init (void); + +#endif /* unwind_i_h */ diff -Nuar libunwind-1.5.0.org/tests/Makefile.am libunwind-1.5.0.sw/tests/Makefile.am --- libunwind-1.5.0.org/tests/Makefile.am 2022-03-24 07:05:05.113873440 +0000 +++ libunwind-1.5.0.sw/tests/Makefile.am 2022-03-16 09:18:39.000000000 +0000 @@ -115,6 +115,10 @@ XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP) endif +if ARCH_SW_64 +XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP) +endif + if ARCH_ARM # ARM Linux kernel >=2.6.39 removed PTRACE_SINGLESTEP emulation XFAIL_TESTS += $(XFAIL_TESTS_PTRACE_SINGLESTEP) diff -Nuar libunwind-1.5.0.org/tests/Makefile.in libunwind-1.5.0.sw/tests/Makefile.in --- libunwind-1.5.0.org/tests/Makefile.in 2022-03-24 07:05:05.113873440 +0000 +++ libunwind-1.5.0.sw/tests/Makefile.in 2022-03-17 08:07:49.000000000 +0000 @@ -134,6 +134,8 @@ # ptrace gives EBADREG when testing, # but generally everything else works. @NO_PTRACE_TEST_TRUE@am__append_19 = run-ptrace-mapper test-ptrace Ltest-init-local-signal +XFAIL_TESTS = $(am__append_20) +@ARCH_SW_64_TRUE@am__append_20 = $(XFAIL_TESTS_PTRACE_SINGLESTEP) noinst_PROGRAMS = $(am__EXEEXT_11) $(am__EXEEXT_15) $(am__EXEEXT_18) subdir = tests ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 diff -Nuar libunwind-1.5.0.org/tests/check-namespace.sh.in libunwind-1.5.0.sw/tests/check-namespace.sh.in --- libunwind-1.5.0.org/tests/check-namespace.sh.in 2022-03-24 07:05:05.113873440 +0000 +++ libunwind-1.5.0.sw/tests/check-namespace.sh.in 2022-03-16 09:18:39.000000000 +0000 @@ -164,6 +164,13 @@ match _UL${plat}_dwarf_find_unwind_table match _U${plat}_setcontext ;; + sw_64) + match _U${plat}_get_elf_image + match _U${plat}_get_exe_image_path + match _U${plat}_is_fpreg + match _UL${plat}_dwarf_search_unwind_table + match _UL${plat}_dwarf_find_unwind_table + ;; ppc*) match _U${plat}_get_func_addr match _U${plat}_get_elf_image @@ -272,6 +279,13 @@ match _U${plat}_dwarf_search_unwind_table match _U${plat}_dwarf_find_unwind_table ;; + sw_64) + match _U${plat}_get_elf_image + match _U${plat}_get_exe_image_path + match _U${plat}_is_fpreg + match _U${plat}_dwarf_search_unwind_table + match _U${plat}_dwarf_find_unwind_table + ;; ppc*) match _U${plat}_get_elf_image match _U${plat}_get_exe_image_path
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.