From d1c27e26f94b13dbda12e171e62228f532cf484c Mon Sep 17 00:00:00 2001 From: davem Date: Sun, 21 Apr 2002 09:37:49 +0000 Subject: 2002-04-19 David S. Miller * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52575 138bc75d-0d04-0410-961f-82ee72b054a4 --- libjava/include/dwarf2-signal.h | 55 ++++++++++++++++++++++++++++++++++++++--- libjava/include/sparc-signal.h | 9 +++++-- 2 files changed, 58 insertions(+), 6 deletions(-) (limited to 'libjava/include') diff --git a/libjava/include/dwarf2-signal.h b/libjava/include/dwarf2-signal.h index cde0fa9d8cc..08287056705 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 03538eccf20..8694fc598ed 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)); \ -- cgit v1.2.3