This is the mail archive of the
frysk@sources.redhat.com
mailing list for the frysk project.
Fwd: libunwind stubs for ppc64
- From: "Wu Zhou" <woodzltc at gmail dot com>
- To: frysk at sources dot redhat dot com
- Date: Thu, 17 Aug 2006 23:47:09 +0800
- Subject: Fwd: libunwind stubs for ppc64
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=aeY+wucd+9uaVbAosTZe1bmcI/F9Tt61/lDbJVV0nV3PKMRLnKVr4PyNdT++q7/tK9zk2bIgKdvx1wBsI6HIP2WrXBSc4+x+9OIGNRr8Ki/X91+fTKsZ7XpG5C/Pc79J+pbrNOx/66GZki6PJ5iLHIGGnN/NSP+2VkW6xQ40pnQ=
- References: <4e8ba5bf0608170835k15bd3c7ucd028348259e9ed8@mail.gmail.com>
Andrew,
Here is the patch to stub libunwind for ppc64, as we had discussed a few days.
It has three parts, all of which are attached below.
1. patch to enable use_libunwind on ppc64 (in common/m4/frysk- use-libunwind.m4)
2. patch to bootstrap libunwind auto make and lib/unwind makefile.gen
(in frysk-imports/bootstrap.sh)
3. the actual libunwind stubs for ppc64. (in frysk-imports/libunwind)
I had tested it on ppc64, it can build ok without any extra patch.
I also tested the patch on x86, no regression found.
Any comments?
Regards
- Wu Zhou
--- frysk/frysk-imports/common/m4/frysk-use-libunwind.m4 2006-07-11 10:59:48.000000000 +0800
+++ ./frysk.ppc64stubs/frysk-imports/common/m4/frysk-use-libunwind.m4 2006-08-17 22:41:49.000000000 +0800
@@ -40,7 +40,7 @@
AC_DEFUN([FRYSK_USE_LIBUNWIND], [
AC_REQUIRE([AC_CANONICAL_TARGET])
case $target_cpu in
-i?86|x86_64|ia64)
+i?86|x86_64|ia64|powerpc64)
use_libunwind=yes;;
*) use_libunwind=no;;
esac
@@ -48,6 +48,7 @@
# libunwind uses a slightly different terminology:
case $target_cpu in
i?86) AC_SUBST([libunwind_cpu], [x86]);;
+powerpc64) AC_SUBST([libunwind_cpu], [ppc64]);;
*) AC_SUBST([libunwind_cpu], [$target_cpu]);;
esac
])
--- frysk/frysk-imports/bootstrap.sh 2006-08-02 03:38:11.000000000 +0800
+++ ./frysk.ppc64stubs/frysk-imports/bootstrap.sh 2006-08-17 23:21:49.000000000 +0800
@@ -53,7 +53,7 @@
target_cpu=`uname -a`
case "${target_cpu}" in
- *86*)
+ *)
# libunwind is supported on X86 and X86_64 now, so buildlibunwind
# java binding. When libunwind is supported on PPC/PPC64, libuwind
# and its java bindings could be built unconditionally.
diff -uNr frysk/frysk-imports/libunwind/include/libunwind-ppc64.h frysk.ppc64stubs/frysk-imports/libunwind/include/libunwind-ppc64.h
--- frysk/frysk-imports/libunwind/include/libunwind-ppc64.h 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/include/libunwind-ppc64.h 2006-08-17 22:34:55.000000000 +0800
@@ -0,0 +1,191 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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 <ucontext.h>
+
+#define UNW_TARGET ppc64
+#define UNW_TARGET_PPC64 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.
+
+ XXX: how big should this be for ppc64. */
+
+#define UNW_TDEP_CURSOR_LEN 127
+
+typedef uint64_t unw_word_t;
+typedef int64_t unw_sword_t;
+
+typedef long double unw_tdep_fpreg_t;
+
+typedef enum
+ {
+ UNW_PPC64_R0,
+ UNW_PPC64_R1,
+ UNW_PPC64_R2,
+ UNW_PPC64_R3,
+ UNW_PPC64_R4,
+ UNW_PPC64_R5,
+ UNW_PPC64_R6,
+ UNW_PPC64_R7,
+ UNW_PPC64_R8,
+ UNW_PPC64_R9,
+ UNW_PPC64_R10,
+ UNW_PPC64_R11,
+ UNW_PPC64_R12,
+ UNW_PPC64_R13,
+ UNW_PPC64_R14,
+ UNW_PPC64_R15,
+ UNW_PPC64_R16,
+ UNW_PPC64_R17,
+ UNW_PPC64_R18,
+ UNW_PPC64_R19,
+ UNW_PPC64_R20,
+ UNW_PPC64_R21,
+ UNW_PPC64_R22,
+ UNW_PPC64_R23,
+ UNW_PPC64_R24,
+ UNW_PPC64_R25,
+ UNW_PPC64_R26,
+ UNW_PPC64_R27,
+ UNW_PPC64_R28,
+ UNW_PPC64_R29,
+ UNW_PPC64_R30,
+ UNW_PPC64_R31,
+
+ UNW_PPC64_NIP,
+ UNW_PPC64_MSR,
+ UNW_PPC64_ORIG_GPR3,
+ UNW_PPC64_CTR,
+ UNW_PPC64_LR,
+ UNW_PPC64_XER,
+ UNW_PPC64_CCR,
+ UNW_PPC64_MQ,
+ UNW_PPC64_TRAP,
+ UNW_PPC64_DAR,
+ UNW_PPC64_DSISR,
+ UNW_PPC64_RESULT,
+
+ UNW_PPC64_F0 = 48,
+ UNW_PPC64_F1,
+ UNW_PPC64_F2,
+ UNW_PPC64_F3,
+ UNW_PPC64_F4,
+ UNW_PPC64_F5,
+ UNW_PPC64_F6,
+ UNW_PPC64_F7,
+ UNW_PPC64_F8,
+ UNW_PPC64_F9,
+ UNW_PPC64_F10,
+ UNW_PPC64_F11,
+ UNW_PPC64_F12,
+ UNW_PPC64_F13,
+ UNW_PPC64_F14,
+ UNW_PPC64_F15,
+ UNW_PPC64_F16,
+ UNW_PPC64_F17,
+ UNW_PPC64_F18,
+ UNW_PPC64_F19,
+ UNW_PPC64_F20,
+ UNW_PPC64_F21,
+ UNW_PPC64_F22,
+ UNW_PPC64_F23,
+ UNW_PPC64_F24,
+ UNW_PPC64_F25,
+ UNW_PPC64_F26,
+ UNW_PPC64_F27,
+ UNW_PPC64_F28,
+ UNW_PPC64_F29,
+ UNW_PPC64_F30,
+ UNW_PPC64_F31,
+ UNW_PPC64_FPSCR,
+
+ /* XXX Add other regs here */
+
+ /* frame info (read-only) */
+ UNW_PPC64_CFA,
+
+ UNW_TDEP_LAST_REG = UNW_PPC64_F31,
+
+ UNW_TDEP_IP = UNW_PPC64_NIP,
+ UNW_TDEP_SP = UNW_PPC64_R1,
+ UNW_TDEP_EH = UNW_PPC64_R12
+ }
+ppc64_regnum_t;
+
+/* XXX: the number of exception arguments. Not sure what is the value
+ for PPC64 at this time. */
+#define UNW_TDEP_NUM_EH_REGS 2
+
+typedef struct unw_tdep_save_loc
+ {
+ /* Additional target-dependent info on a save location. */
+ }
+unw_tdep_save_loc_t;
+
+/* On ppc64, we can directly use ucontext_t as the unwind context. */
+typedef ucontext_t unw_tdep_context_t;
+
+/* XXX this is not ideal: an application should not be prevented from
+ using the "getcontext" name just because it's using libunwind. We
+ can't just use __getcontext() either, because that isn't exported
+ by glibc... */
+#define unw_tdep_getcontext(uc) (getcontext (uc), 0)
+
+#include "libunwind-dynamic.h"
+
+typedef struct
+ {
+ /* no ppc64-specific auxiliary proc-info */
+ }
+unw_tdep_proc_info_t;
+
+#include "libunwind-common.h"
+
+#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 -uNr frysk/frysk-imports/libunwind/include/tdep-ppc64/dwarf-config.h frysk.ppc64stubs/frysk-imports/libunwind/include/tdep-ppc64/dwarf-config.h
--- frysk/frysk-imports/libunwind/include/tdep-ppc64/dwarf-config.h 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/include/tdep-ppc64/dwarf-config.h 2006-08-17 22:34:36.000000000 +0800
@@ -0,0 +1,54 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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
+
+/* XXX: For PPC64, 48 GPRs + 33 FPRs. */
+#define DWARF_NUM_PRESERVED_REGS 81
+
+#define DWARF_REGNUM_MAP_LENGTH 81
+
+/* Return TRUE if the ADDR_SPACE uses big-endian byte-order. */
+#define dwarf_is_big_endian(addr_space) 1
+
+/* 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 X86_LOC_TYPE_* macros. */
+#endif
+ }
+dwarf_loc_t;
+
+#endif /* dwarf_config_h */
diff -uNr frysk/frysk-imports/libunwind/include/tdep-ppc64/jmpbuf.h frysk.ppc64stubs/frysk-imports/libunwind/include/tdep-ppc64/jmpbuf.h
--- frysk/frysk-imports/libunwind/include/tdep-ppc64/jmpbuf.h 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/include/tdep-ppc64/jmpbuf.h 2006-08-17 22:34:36.000000000 +0800
@@ -0,0 +1,35 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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: */
+
+#define JB_SP 6
+#define JB_RP 7
+#define JB_MASK_SAVED 8
+#define JB_MASK 9
diff -uNr frysk/frysk-imports/libunwind/include/tdep-ppc64/libunwind_i.h frysk.ppc64stubs/frysk-imports/libunwind/include/tdep-ppc64/libunwind_i.h
--- frysk/frysk-imports/libunwind/include/tdep-ppc64/libunwind_i.h 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/include/tdep-ppc64/libunwind_i.h 2006-08-17 22:34:36.000000000 +0800
@@ -0,0 +1,199 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from libunwind-x86_64.h, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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 PPC64_LIBUNWIND_I_H
+#define PPC64_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 "dwarf.h"
+
+struct unw_addr_space
+ {
+ struct unw_accessors acc;
+ 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 cursor
+ {
+ struct dwarf_cursor dwarf; /* must be first */
+
+ /* Format of sigcontext structure and address at which it is
+ stored: */
+ enum
+ {
+ PPC64_SCF_NONE, /* no signal frame encountered */
+ PPC64_SCF_LINUX_RT_SIGFRAME /* POSIX ucontext_t */
+ }
+ sigcontext_format;
+ unw_word_t sigcontext_addr;
+ };
+
+#define DWARF_GET_LOC(l) ((l).val)
+
+#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) \
+ 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) \
+ tdep_uc_addr((c)->as_arg, (r)), 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))
+
+#endif /* !UNW_LOCAL_ONLY */
+
+static inline int
+dwarf_getfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t *val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+//# warning fix me
+ abort ();
+}
+
+static inline int
+dwarf_putfp (struct dwarf_cursor *c, dwarf_loc_t loc, unw_fpreg_t val)
+{
+ if (DWARF_IS_NULL_LOC (loc))
+ return -UNW_EBADREG;
+
+//# warning fix me
+ abort ();
+}
+
+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 (DWARF_IS_FP_LOC (loc))
+//# warning fix me
+// abort ();
+
+ 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 (DWARF_IS_FP_LOC (loc))
+//# warning fix me
+// abort ();
+
+ 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);
+}
+
+#define tdep_needs_initialization UNW_OBJ(needs_initialization)
+#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_uc_addr UNW_ARCH_OBJ(uc_addr)
+#define tdep_get_elf_image UNW_ARCH_OBJ(get_elf_image)
+#define tdep_access_reg UNW_OBJ(access_reg)
+#define tdep_access_fpreg UNW_OBJ(access_fpreg)
+
+#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)
+#define tdep_big_endian(as) 0
+
+extern int tdep_needs_initialization;
+
+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);
+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 /* PPC64_LIBUNWIND_I_H */
diff -uNr frysk/frysk-imports/libunwind/include/tdep-ppc64/README frysk.ppc64stubs/frysk-imports/libunwind/include/tdep-ppc64/README
--- frysk/frysk-imports/libunwind/include/tdep-ppc64/README 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/include/tdep-ppc64/README 2006-08-17 22:34:36.000000000 +0800
@@ -0,0 +1,3 @@
+Header files in this directory are copied from include/tdep-x86_64, modified
+slightly to build frysk successfully on ppc64. When libunwind is ready for
+ppc64 usage, all code here will be replaced.
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Gcreate_addr_space.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gcreate_addr_space.c
--- frysk/frysk-imports/libunwind/src/ppc64/Gcreate_addr_space.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gcreate_addr_space.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,56 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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"
+
+PROTECTED 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 = malloc (sizeof (*as));
+
+ if (!as)
+ return NULL;
+
+ memset (as, 0, sizeof (*as));
+
+ as->acc = *a;
+
+ /*
+ * Linux ppc64 supports only big-endian.
+ */
+ if (byte_order != 0 && byte_order != __BIG_ENDIAN)
+ return NULL;
+ return as;
+#endif
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Gget_proc_info.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gget_proc_info.c
--- frysk/frysk-imports/libunwind/src/ppc64/Gget_proc_info.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gget_proc_info.c 2006-08-17 22:35:23.000000000 +0800
@@ -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>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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"
+
+PROTECTED int
+unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Gget_save_loc.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gget_save_loc.c
--- frysk/frysk-imports/libunwind/src/ppc64/Gget_save_loc.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gget_save_loc.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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"
+
+PROTECTED int
+unw_get_save_loc (unw_cursor_t *cursor, int reg, unw_save_loc_t *sloc)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Gglobal.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gglobal.c
--- frysk/frysk-imports/libunwind/src/ppc64/Gglobal.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gglobal.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,100 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003, 2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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 pthread_mutex_t ppc64_lock = PTHREAD_MUTEX_INITIALIZER;
+HIDDEN int tdep_needs_initialization = 1;
+
+/* See comments for svr4_dbx_register_map[] in gcc/config/i386/i386.c. */
+
+uint8_t dwarf_to_unw_regnum_map[DWARF_REGNUM_MAP_LENGTH] =
+ {
+ UNW_PPC64_R0,
+ UNW_PPC64_R1,
+ UNW_PPC64_R2,
+ UNW_PPC64_R3,
+ UNW_PPC64_R4,
+ UNW_PPC64_R5,
+ UNW_PPC64_R6,
+ UNW_PPC64_R7,
+ UNW_PPC64_R8,
+ UNW_PPC64_R9,
+ UNW_PPC64_R10,
+ UNW_PPC64_R11,
+ UNW_PPC64_R12,
+ UNW_PPC64_R13,
+ UNW_PPC64_R14,
+ UNW_PPC64_R15,
+ UNW_PPC64_R16,
+ UNW_PPC64_R17,
+ UNW_PPC64_R18,
+ UNW_PPC64_R19,
+ UNW_PPC64_R20,
+ UNW_PPC64_R21,
+ UNW_PPC64_R22,
+ UNW_PPC64_R23,
+ UNW_PPC64_R24,
+ UNW_PPC64_R25,
+ UNW_PPC64_R26,
+ UNW_PPC64_R27,
+ UNW_PPC64_R28,
+ UNW_PPC64_R29,
+ UNW_PPC64_R30,
+ UNW_PPC64_R31
+ };
+
+HIDDEN void
+tdep_init (void)
+{
+ intrmask_t saved_mask;
+
+ sigfillset (&unwi_full_mask);
+
+ sigprocmask (SIG_SETMASK, &unwi_full_mask, &saved_mask);
+ mutex_lock (&ppc64_lock);
+ {
+ if (!tdep_needs_initialization)
+ /* another thread else beat us to it... */
+ goto out;
+
+ mi_init ();
+
+ dwarf_init ();
+
+#ifndef UNW_REMOTE_ONLY
+ ppc64_local_addr_space_init ();
+#endif
+ tdep_needs_initialization = 0; /* signal that we're initialized... */
+ }
+ out:
+ mutex_unlock (&ppc64_lock);
+ sigprocmask (SIG_SETMASK, &saved_mask, NULL);
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Ginit.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Ginit.c
--- frysk/frysk-imports/libunwind/src/ppc64/Ginit.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Ginit.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,152 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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 <sys/mman.h>
+
+#include "unwind_i.h"
+
+#ifdef UNW_REMOTE_ONLY
+
+/* unw_local_addr_space is a NULL pointer in this case. */
+PROTECTED unw_addr_space_t unw_local_addr_space;
+
+#else /* !UNW_REMOTE_ONLY */
+
+static struct unw_addr_space local_addr_space;
+
+PROTECTED unw_addr_space_t unw_local_addr_space = &local_addr_space;
+
+static inline void *
+uc_addr (ucontext_t *uc, int reg)
+{
+ /* XXX: empty stub. */
+ return NULL;
+}
+
+# ifdef UNW_LOCAL_ONLY
+
+HIDDEN void *
+tdep_uc_addr (ucontext_t *uc, int reg)
+{
+ return uc_addr (uc, reg);
+}
+
+# endif /* UNW_LOCAL_ONLY */
+
+HIDDEN unw_dyn_info_list_t _U_dyn_info_list;
+
+/* XXX fix me: there is currently no way to locate the dyn-info list
+ by a remote unwinder. On ia64, this is done via a special
+ unwind-table entry. Perhaps something similar can be done with
+ DWARF2 unwind info. */
+
+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)
+{
+ *dyn_info_list_addr = (unw_word_t) &_U_dyn_info_list;
+ return 0;
+}
+
+#define PAGE_SIZE 4096
+#define PAGE_START(a) ((a) & ~(PAGE_SIZE-1))
+
+/* Cache of already validated addresses */
+#define NLGA 4
+static unw_word_t last_good_addr[NLGA];
+static int lga_victim;
+
+static int
+validate_mem (unw_word_t addr)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
+
+static int
+access_mem (unw_addr_space_t as, unw_word_t addr, unw_word_t *val, int write,
+ void *arg)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
+
+static int
+access_reg (unw_addr_space_t as, unw_regnum_t reg, unw_word_t *val, int write,
+ void *arg)
+{
+ /* XXX: empty stub. */
+ return -UNW_EBADREG;
+}
+
+static int
+access_fpreg (unw_addr_space_t as, unw_regnum_t reg, unw_fpreg_t *val,
+ int write, void *arg)
+{
+ /* XXX: empty stub. */
+ 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 _Uelf64_get_proc_name (getpid (), ip, buf, buf_len, offp);
+}
+
+HIDDEN void
+ppc64_local_addr_space_init (void)
+{
+ memset (&local_addr_space, 0, sizeof (local_addr_space));
+ local_addr_space.caching_policy = UNW_CACHE_GLOBAL;
+ 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 = ppc64_local_resume;
+ local_addr_space.acc.get_proc_name = get_static_proc_name;
+ unw_flush_cache (&local_addr_space, 0, 0);
+
+ local_addr_space.acc.validate = 0;
+ bzero(last_good_addr, sizeof(unw_word_t) * NLGA);
+ lga_victim = 0;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Ginit_local.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Ginit_local.c
--- frysk/frysk-imports/libunwind/src/ppc64/Ginit_local.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Ginit_local.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,59 @@
+/* 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>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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
+
+PROTECTED int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ /* XXX: empty stub. */
+ return -UNW_EINVAL;
+}
+
+#else /* !UNW_REMOTE_ONLY */
+
+PROTECTED int
+unw_init_local (unw_cursor_t *cursor, ucontext_t *uc)
+{
+ struct cursor *c = (struct cursor *) cursor;
+
+ if (tdep_needs_initialization)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = unw_local_addr_space;
+ c->dwarf.as_arg = uc;
+ return common_init (c);
+}
+
+#endif /* !UNW_REMOTE_ONLY */
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Ginit_remote.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Ginit_remote.c
--- frysk/frysk-imports/libunwind/src/ppc64/Ginit_remote.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Ginit_remote.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,50 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2003 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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"
+
+PROTECTED 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_needs_initialization)
+ tdep_init ();
+
+ Debug (1, "(cursor=%p)\n", c);
+
+ c->dwarf.as = as;
+ c->dwarf.as_arg = as_arg;
+ return common_init (c);
+#endif /* !UNW_LOCAL_ONLY */
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Gis_signal_frame.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gis_signal_frame.c
--- frysk/frysk-imports/libunwind/src/ppc64/Gis_signal_frame.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gis_signal_frame.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,37 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2003 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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"
+
+PROTECTED int
+unw_is_signal_frame (unw_cursor_t *cursor)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Gregs.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gregs.c
--- frysk/frysk-imports/libunwind/src/ppc64/Gregs.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gregs.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,46 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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"
+
+HIDDEN int
+tdep_access_reg (struct cursor *c, unw_regnum_t reg, unw_word_t *valp,
+ int write)
+{
+ /* XXX: empty stub. */
+ return -UNW_EBADREG;
+}
+
+HIDDEN int
+tdep_access_fpreg (struct cursor *c, unw_regnum_t reg, unw_fpreg_t *valp,
+ int write)
+{
+ /* XXX: empty stub. */
+ return -UNW_EBADREG;
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Gresume.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gresume.c
--- frysk/frysk-imports/libunwind/src/ppc64/Gresume.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gresume.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,79 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2002-2004 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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
+
+#include <sys/syscall.h>
+
+/* sigreturn() is a no-op on x86_64 glibc. */
+
+static NORETURN inline long
+my_rt_sigreturn (void *new_sp)
+{
+ /* XXX: empty stub. */
+ abort ();
+}
+
+HIDDEN inline int
+ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor, void *arg)
+{
+ /* XXX: empty stub. */
+ return -UNW_EINVAL;
+}
+
+#endif /* !UNW_REMOTE_ONLY */
+
+/* This routine is responsible for copying the register values in
+ cursor C and establishing them as the current machine state. */
+
+static inline int
+establish_machine_state (struct cursor *c)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
+
+PROTECTED 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 -uNr frysk/frysk-imports/libunwind/src/ppc64/Gstep.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gstep.c
--- frysk/frysk-imports/libunwind/src/ppc64/Gstep.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Gstep.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,39 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002-2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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 "ucontext_i.h"
+#include <signal.h>
+
+PROTECTED int
+unw_step (unw_cursor_t *cursor)
+{
+ /* XXX: empty stub. */
+ return 0;
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/init.h frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/init.h
--- frysk/frysk-imports/libunwind/src/ppc64/init.h 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/init.h 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,91 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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)
+{
+ int ret;
+
+ c->dwarf.loc[R0] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R0);
+ c->dwarf.loc[R1] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R1);
+ c->dwarf.loc[R2] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R2);
+ c->dwarf.loc[R3] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R3);
+ c->dwarf.loc[R4] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R4);
+ c->dwarf.loc[R5] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R5);
+ c->dwarf.loc[R6] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R6);
+ c->dwarf.loc[R7] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R7);
+ c->dwarf.loc[R8] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R8);
+ c->dwarf.loc[R9] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R9);
+ c->dwarf.loc[R10] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R10);
+ c->dwarf.loc[R11] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R11);
+ c->dwarf.loc[R12] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R12);
+ c->dwarf.loc[R13] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R13);
+ c->dwarf.loc[R14] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R14);
+ c->dwarf.loc[R15] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R15);
+ c->dwarf.loc[R16] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R16);
+ c->dwarf.loc[R17] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R17);
+ c->dwarf.loc[R18] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R18);
+ c->dwarf.loc[R19] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R19);
+ c->dwarf.loc[R20] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R20);
+ c->dwarf.loc[R21] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R21);
+ c->dwarf.loc[R22] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R22);
+ c->dwarf.loc[R23] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R23);
+ c->dwarf.loc[R24] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R24);
+ c->dwarf.loc[R25] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R25);
+ c->dwarf.loc[R26] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R26);
+ c->dwarf.loc[R27] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R27);
+ c->dwarf.loc[R28] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R28);
+ c->dwarf.loc[R29] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R29);
+ c->dwarf.loc[R30] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R30);
+ c->dwarf.loc[R31] = DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R31);
+
+// XXX: how to get nip?
+// ret = dwarf_get (&c->dwarf, c->dwarf.loc[NIP], &c->dwarf.ip);
+// if (ret < 0)
+// return ret;
+
+ ret = dwarf_get (&c->dwarf, DWARF_REG_LOC (&c->dwarf, UNW_PPC64_R1),
+ &c->dwarf.cfa);
+ if (ret < 0)
+ return ret;
+
+ c->sigcontext_format = PPC64_SCF_NONE;
+ c->sigcontext_addr = 0;
+
+ c->dwarf.args_size = 0;
+ c->dwarf.ret_addr_column = 0;
+ c->dwarf.pi_valid = 0;
+ c->dwarf.pi_is_dynamic = 0;
+ c->dwarf.hint = 0;
+ c->dwarf.prev_rs = 0;
+
+ return 0;
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/is_fpreg.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/is_fpreg.c
--- frysk/frysk-imports/libunwind/src/ppc64/is_fpreg.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/is_fpreg.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,36 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (c) 2004-2005 Hewlett-Packard Development Company, L.P.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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"
+
+PROTECTED int
+unw_is_fpreg (int regnum)
+{
+ return (regnum >= UNW_PPC64_F0 && regnum <= UNW_PPC64_F31);
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/longjmp.S frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/longjmp.S
--- frysk/frysk-imports/libunwind/src/ppc64/longjmp.S 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/longjmp.S 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,34 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004-2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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. */
+
+ .globl _UI_longjmp_cont
+
+ .type _UI_longjmp_cont, @function
+_UI_longjmp_cont:
+ .size _UI_longjmp_cont, .-_UI_longjmp_cont
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/Make-arch.in frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Make-arch.in
--- frysk/frysk-imports/libunwind/src/ppc64/Make-arch.in 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/Make-arch.in 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,11 @@
+# Word size.
+ELFW = 64
+# Does use dwarf2 unwind info.
+dwarf_target = true
+
+libunwind_setjmp_OBJS += \
+ $(arch)/longjmp.o \
+ $(arch)/siglongjmp.o
+
+libunwind_OBJS_common += \
+ $(arch)/is_fpreg.o
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/README frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/README
--- frysk/frysk-imports/libunwind/src/ppc64/README 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/README 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,5 @@
+Source files in this directory are copied from src/x86_64, modified to build
+frysk successfully on ppc64. When libunwind is ready for ppc64 usage, all
+code here will be replaced.
+
+Currently most routines in this directory are empty stubs.
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/regname.c frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/regname.c
--- frysk/frysk-imports/libunwind/src/ppc64/regname.c 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/regname.c 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,117 @@
+/* libunwind - a platform-independent unwind library
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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[] =
+ {
+ "R0",
+ "R1",
+ "R2",
+ "R3",
+ "R4",
+ "R5",
+ "R6",
+ "R7",
+ "R8",
+ "R9",
+ "R10",
+ "R11",
+ "R12",
+ "R13",
+ "R14",
+ "R15",
+ "R16",
+ "R17",
+ "R18",
+ "R19",
+ "R20",
+ "R21",
+ "R22",
+ "R23",
+ "R24",
+ "R25",
+ "R26",
+ "R27",
+ "R28",
+ "R29",
+ "R30",
+ "R31",
+ "NIP",
+ "MSR",
+ "ORIG_GPR3",
+ "CTR",
+ "LINK",
+ "XER",
+ "CCR",
+ "MQ",
+ "TRAP",
+ "DAR",
+ "DSISR",
+ "RESULT",
+ "F0",
+ "F1",
+ "F2",
+ "F3",
+ "F4",
+ "F5",
+ "F6",
+ "F7",
+ "F8",
+ "F9",
+ "F10",
+ "F11",
+ "F12",
+ "F13",
+ "F14",
+ "F15",
+ "F16",
+ "F17",
+ "F18",
+ "F19",
+ "F20",
+ "F21",
+ "F22",
+ "F23",
+ "F24",
+ "F25",
+ "F26",
+ "F27",
+ "F28",
+ "F29",
+ "F30",
+ "F31"
+ };
+
+PROTECTED const char *
+unw_regname (unw_regnum_t reg)
+{
+ if (reg < (unw_regnum_t) ARRAY_SIZE (regname))
+ return regname[reg];
+ else
+ return "???";
+}
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/setcontext.S frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/setcontext.S
--- frysk/frysk-imports/libunwind/src/ppc64/setcontext.S 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/setcontext.S 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,4 @@
+ .global _UI_setcontext
+
+_UI_setcontext:
+ retq
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/siglongjmp.S frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/siglongjmp.S
--- frysk/frysk-imports/libunwind/src/ppc64/siglongjmp.S 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/siglongjmp.S 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,33 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2004 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly (or made empty stubs) for
+ building frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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. */
+
+ .globl _UI_siglongjmp_cont
+
+/*_UI_siglongjmp_cont:
+ retq */
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/ucontext_i.h frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/ucontext_i.h
--- frysk/frysk-imports/libunwind/src/ppc64/ucontext_i.h 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/ucontext_i.h 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,60 @@
+/* Copyright (C) 2004 Hewlett-Packard Co.
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>.
+
+ Copied from src/x86_64/, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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. */
+
+/* XXX: what are these for, to find the value of dwarf register from
+ the ucontext structure? Need to do more investigation for this. */
+#define UC_MCONTEXT_GREGS_R0
+#define UC_MCONTEXT_GREGS_R1
+#define UC_MCONTEXT_GREGS_R2
+#define UC_MCONTEXT_GREGS_R3
+#define UC_MCONTEXT_GREGS_R4
+#define UC_MCONTEXT_GREGS_R5
+#define UC_MCONTEXT_GREGS_R6
+#define UC_MCONTEXT_GREGS_R7
+#define UC_MCONTEXT_GREGS_R8
+#define UC_MCONTEXT_GREGS_R9
+#define UC_MCONTEXT_GREGS_R10
+#define UC_MCONTEXT_GREGS_R11
+#define UC_MCONTEXT_GREGS_R12
+#define UC_MCONTEXT_GREGS_R13
+#define UC_MCONTEXT_GREGS_R14
+#define UC_MCONTEXT_GREGS_R15
+#define UC_MCONTEXT_GREGS_R16
+#define UC_MCONTEXT_GREGS_R17
+#define UC_MCONTEXT_GREGS_R18
+#define UC_MCONTEXT_GREGS_R19
+#define UC_MCONTEXT_GREGS_R20
+#define UC_MCONTEXT_GREGS_R21
+#define UC_MCONTEXT_GREGS_R22
+#define UC_MCONTEXT_GREGS_R23
+#define UC_MCONTEXT_GREGS_R24
+#define UC_MCONTEXT_GREGS_R25
+#define UC_MCONTEXT_GREGS_R26
+#define UC_MCONTEXT_GREGS_R27
+#define UC_MCONTEXT_GREGS_R28
+#define UC_MCONTEXT_GREGS_R29
+#define UC_MCONTEXT_GREGS_R30
+#define UC_MCONTEXT_GREGS_R31
diff -uNr frysk/frysk-imports/libunwind/src/ppc64/unwind_i.h frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/unwind_i.h
--- frysk/frysk-imports/libunwind/src/ppc64/unwind_i.h 1970-01-01 08:00:00.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ppc64/unwind_i.h 2006-08-17 22:35:23.000000000 +0800
@@ -0,0 +1,130 @@
+/* libunwind - a platform-independent unwind library
+ Copyright (C) 2002, 2005 Hewlett-Packard Co
+ Contributed by David Mosberger-Tang <davidm@hpl.hp.com>
+
+ Copied from src/x86_64/, modified slightly for building
+ frysk successfully on ppc64, by Wu Zhou <woodzltc@cn.ibm.com>
+ Will be replaced when libunwind is ready on ppc64 platform.
+
+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 <memory.h>
+#include <stdint.h>
+
+#include <libunwind-ppc64.h>
+
+#include "libunwind_i.h"
+#include <sys/ucontext.h>
+
+/* DWARF column numbers for ppc64: */
+#define R0 0
+#define R1 1
+#define R2 2
+#define R3 3
+#define R4 4
+#define R5 5
+#define R6 6
+#define R7 7
+#define R8 8
+#define R9 9
+#define R10 10
+#define R11 11
+#define R12 12
+#define R13 13
+#define R14 14
+#define R15 15
+#define R16 16
+#define R17 17
+#define R18 18
+#define R19 19
+#define R20 20
+#define R21 21
+#define R22 22
+#define R23 23
+#define R24 24
+#define R25 25
+#define R26 26
+#define R27 27
+#define R28 28
+#define R29 29
+#define R30 30
+#define R31 31
+
+#define F0 32
+#define F1 33
+#define F2 34
+#define F3 35
+#define F4 36
+#define F5 37
+#define F6 38
+#define F7 39
+#define F8 40
+#define F9 41
+#define F10 42
+#define F11 43
+#define F12 44
+#define F13 45
+#define F14 46
+#define F15 47
+#define F16 48
+#define F17 49
+#define F18 50
+#define F19 51
+#define F20 52
+#define F21 53
+#define F22 54
+#define F23 55
+#define F24 56
+#define F25 57
+#define F26 58
+#define F27 59
+#define F28 60
+#define F29 61
+#define F30 62
+#define F31 63
+
+#define CR 64
+#define FPSCR 65
+#define MSR 66
+#define MQ 100
+#define XER 101
+#define LR 108
+#define CTR 109
+
+#define ppc64_lock UNW_OBJ(lock)
+#define ppc64_local_resume UNW_OBJ(local_resume)
+#define ppc64_local_addr_space_init UNW_OBJ(local_addr_space_init)
+#if 0
+#define ppc64_scratch_loc UNW_OBJ(scratch_loc)
+#endif
+
+extern void ppc64_local_addr_space_init (void);
+extern int ppc64_local_resume (unw_addr_space_t as, unw_cursor_t *cursor,
+ void *arg);
+#if 0
+extern dwarf_loc_t ppc64_scratch_loc (struct cursor *c, unw_regnum_t reg);
+#endif
+
+#endif /* unwind_i_h */
diff -uNr frysk/frysk-imports/libunwind/src/ptrace/_UPT_reg_offset.c frysk.ppc64stubs/frysk-imports/libunwind/src/ptrace/_UPT_reg_offset.c
--- frysk/frysk-imports/libunwind/src/ptrace/_UPT_reg_offset.c 2006-06-01 03:04:20.000000000 +0800
+++ frysk.ppc64stubs/frysk-imports/libunwind/src/ptrace/_UPT_reg_offset.c 2006-08-17 22:35:40.000000000 +0800
@@ -286,6 +286,7 @@
// [UNW_X86_64_EFLAGS] = 0x90,
// [UNW_X86_64_RSP] = 0x98,
// [UNW_X86_64_SS] = 0xa0
+#elif defined(UNW_TARGET_PPC64)
#else
# error Fix me.
#endif