aboutsummaryrefslogtreecommitdiff
path: root/libjava/include
diff options
context:
space:
mode:
authorDavid S. Miller <davem@redhat.com>2002-04-21 02:37:49 -0700
committerDavid S. Miller <davem@gcc.gnu.org>2002-04-21 02:37:49 -0700
commit714708c8b17ebf951dff34eb42bda1e7e5d0c828 (patch)
treea376bafb010afb2652958e6006378e2f08558082 /libjava/include
parent25c52eacb297f53e64231e5493be27834de44165 (diff)
downloadgcc-714708c8b17ebf951dff34eb42bda1e7e5d0c828.zip
gcc-714708c8b17ebf951dff34eb42bda1e7e5d0c828.tar.gz
gcc-714708c8b17ebf951dff34eb42bda1e7e5d0c828.tar.bz2
dwarf2-signal.h (SIGNAL_HANDLER): Name siginfo_t pointer arg.
2002-04-19 David S. Miller <davem@redhat.com> * include/dwarf2-signal.h (SIGNAL_HANDLER): Name siginfo_t pointer arg. (MAKE_THROW_FRAME): Define for 32-bit and 64-bit sparc. (INIT_SEGV, INIT_FPE): Use direct __libc_sigaction installation on Sparc too. * include/sparc-signal.h (FLUSH_REGISTER_WINDOWS): Define properly for 64-bit sparc. (MAKE_THROW_FRAME): Use long for sp/retaddr so 64-bit works. * sysdeps/sparc/locks.h: New file. * configure.in (SIGNAL_HANDLER): Set to include/sparc-signal.h on all sparc Solaris configurations. Set to include/dwarf2-signal.h on sparc Linux. * configure: Regenerate * configure.host (can_unwind_signal): sparc*-linux* can do it now. From-SVN: r52575
Diffstat (limited to 'libjava/include')
-rw-r--r--libjava/include/dwarf2-signal.h55
-rw-r--r--libjava/include/sparc-signal.h9
2 files changed, 58 insertions, 6 deletions
diff --git a/libjava/include/dwarf2-signal.h b/libjava/include/dwarf2-signal.h
index cde0fa9..0828705 100644
--- a/libjava/include/dwarf2-signal.h
+++ b/libjava/include/dwarf2-signal.h
@@ -21,7 +21,7 @@ details. */
#undef HANDLE_FPE
#define SIGNAL_HANDLER(_name) \
-static void _Jv_##_name (int, siginfo_t *, void *_p)
+static void _Jv_##_name (int, siginfo_t *_sip, void *_p)
class java::lang::Throwable;
@@ -58,6 +58,53 @@ do \
_sc->sc_ip++; \
} \
while (0)
+#elif defined(__sparc__)
+/* We could do the unwind of the signal frame quickly by hand here like
+ sparc-signal.h does under Solaris, but that makes debugging unwind
+ failures almost impossible. */
+#if !defined(__arch64__)
+#define MAKE_THROW_FRAME(_exception) \
+do \
+{ \
+ /* Sparc-32 leaves PC pointing at a faulting instruction \
+ always. So we adjust the saved PC to point to the following \
+ instruction; this is what the handler in libgcc expects. */ \
+ /* Note that we are lying to the unwinder here, which expects the \
+ faulting pc, not pc+1. But we claim the unwind information can't \
+ be changed by such a ld or st instruction, so it doesn't matter. */ \
+ struct sig_regs { \
+ unsigned int psr, pc, npc, y, u_regs[16]; \
+ } *regp; \
+ unsigned int insn; \
+ __asm__ __volatile__("ld [%%i7 + 8], %0" : "=r" (insn)); \
+ if (insn == 0x821020d8) \
+ regp = (struct sig_regs *) _sip; \
+ else \
+ regp = (struct sig_regs *) (_sip + 1); \
+ regp->pc = regp->npc; \
+ regp->npc += 4; \
+} \
+while (0)
+#else
+#define MAKE_THROW_FRAME(_exception) \
+do \
+{ \
+ /* Sparc-64 leaves PC pointing at a faulting instruction \
+ always. So we adjust the saved PC to point to the following \
+ instruction; this is what the handler in libgcc expects. */ \
+ /* Note that we are lying to the unwinder here, which expects the \
+ faulting pc, not pc+1. But we claim the unwind information can't \
+ be changed by such a ld or st instruction, so it doesn't matter. */ \
+ struct pt_regs { \
+ unsigned long u_regs[16]; \
+ unsigned long tstate, tpc, tnpc; \
+ unsigned int y, fprs; \
+ } *regp = (struct pt_regs *) (_sip + 1); \
+ regp->tpc = regp->tnpc; \
+ regp->tnpc += 4; \
+} \
+while (0)
+#endif
#else
#define MAKE_THROW_FRAME(_exception) \
do \
@@ -67,7 +114,7 @@ do \
while (0)
#endif
-#ifndef __ia64__
+#if !(defined(__ia64__) || defined(__sparc__))
#define INIT_SEGV \
do \
{ \
@@ -100,7 +147,7 @@ while (0)
* go away once all systems have pthreads libraries that are
* compiled with full unwind info. */
-#else /* __ia64__ */
+#else /* __ia64__ || __sparc__ */
// FIXME: We shouldn't be using libc_sigaction here, since it should
// be glibc private. But using syscall here would mean translating to
@@ -136,5 +183,5 @@ do \
__libc_sigaction (SIGFPE, &act, NULL); \
} \
while (0)
-#endif /* __ia64__ */
+#endif /* __ia64__ || __sparc__ */
#endif /* JAVA_SIGNAL_H */
diff --git a/libjava/include/sparc-signal.h b/libjava/include/sparc-signal.h
index 03538ec..8694fc5 100644
--- a/libjava/include/sparc-signal.h
+++ b/libjava/include/sparc-signal.h
@@ -20,8 +20,13 @@ details. */
#define SIGNAL_HANDLER(_name) \
static void _name (int _dummy, siginfo_t *_info, void *arg)
+#ifdef __arch64__
+#define FLUSH_REGISTER_WINDOWS \
+ asm volatile ("flushw");
+#else
#define FLUSH_REGISTER_WINDOWS \
asm volatile ("ta 3");
+#endif
#define MAKE_THROW_FRAME(_exception) \
do \
@@ -29,8 +34,8 @@ do \
ucontext_t *_context = (ucontext_t *) arg; \
(void)_dummy; \
(void)_info; \
- register int sp = _context->uc_mcontext.gregs[REG_SP]; \
- register int retaddr = _context->uc_mcontext.gregs[REG_O7]; \
+ register long sp = _context->uc_mcontext.gregs[REG_SP]; \
+ register long retaddr = _context->uc_mcontext.gregs[REG_O7]; \
FLUSH_REGISTER_WINDOWS; \
asm volatile ("mov %0, %%i6; mov %1, %%i7" \
: : "r"(sp), "r"(retaddr)); \