summaryrefslogtreecommitdiff
path: root/libjava/include
diff options
context:
space:
mode:
authorAndrew Haley <aph@redhat.com>2001-05-29 17:50:50 +0000
committerAndrew Haley <aph@gcc.gnu.org>2001-05-29 17:50:50 +0000
commitc9bffcd53e66fefb4e168c8d57d759fa6475f275 (patch)
treee8a819f21050f165845bdc2be079418c748fcfae /libjava/include
parent022dae817d1d2f731e3fcaa7b650319983aeea8b (diff)
downloadgcc-c9bffcd53e66fefb4e168c8d57d759fa6475f275.tar.gz
i386-signal.h (MAKE_THROW_FRAME): Don't fix up frame pointer...
2001-05-29 Andrew Haley <aph@redhat.com> * include/i386-signal.h (MAKE_THROW_FRAME): Don't fix up frame pointer: the dwarf unwinder in libgcc will do everything that's needed. (HANDLE_DIVIDE_OVERFLOW): Tidy. Don't mess with stack frames any more than we absolutely need to. * configure.host (EXCEPTIONSPEC): Remove libgcj_sjlj on Alpha. * configure.in (SIGNAL_HANDLER): Use include/dwarf2-signal.h on Alpha. (SIGNAL_HANDLER): Test "$enable_sjlj_exceptions", not "$libgcj_sjlj". * configure: Rebuilt. * include/dwarf2-signal.h (MAKE_THROW_FRAME): Adjust PC for Alpha. (SIGNAL_HANDLER): Use siginfo style handler. (INIT_SEGV): Likewise. (INIT_FPE): Likewise. * include/ppc-signal.h: Delete whole file. From-SVN: r42691
Diffstat (limited to 'libjava/include')
-rw-r--r--libjava/include/dwarf2-signal.h37
-rw-r--r--libjava/include/i386-signal.h17
-rw-r--r--libjava/include/ppc-signal.h115
3 files changed, 31 insertions, 138 deletions
diff --git a/libjava/include/dwarf2-signal.h b/libjava/include/dwarf2-signal.h
index ec32a7b50e5..3a662aec2d9 100644
--- a/libjava/include/dwarf2-signal.h
+++ b/libjava/include/dwarf2-signal.h
@@ -4,9 +4,8 @@
This file is part of libgcj.
- Use this file for every target for which the dwarf2 unwinder in
- libgcc can unwind through signal handlers and no special actions
- are needed.
+ Use this file for a target for which the dwarf2 unwinder in libgcc
+ can unwind through signal handlers.
This software is copyrighted work licensed under the terms of the
Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
@@ -22,29 +21,43 @@ details. */
#undef HANDLE_FPE
#define SIGNAL_HANDLER(_name) \
-static void _Jv_##_name (int)
+static void _Jv_##_name (int, siginfo_t *, void *_p)
class java::lang::Throwable;
// Unwind the stack to the point at which the signal was generated and
-// then throw an exception. With the dwarf2 unwinder we don't need to
-// do anything.
-
+// then throw an exception. With the dwarf2 unwinder we don't usually
+// need to do anything, with some minor exceptions.
+
+#ifdef __alpha__
+#define MAKE_THROW_FRAME(_exception) \
+do \
+{ \
+ /* Alpha either leaves PC pointing at a faulting instruction or the \
+ following instruction, depending on the signal. SEGV always does \
+ the former, so we adjust the saved PC to point to the following \
+ instruction; this is what the handler in libgcc expects. */ \
+ struct sigcontext *_sc = (struct sigcontext *)_p; \
+ _sc->sc_pc += 4; \
+} \
+while (0)
+#else
#define MAKE_THROW_FRAME(_exception) \
do \
{ \
+ (void)_p; \
} \
while (0)
-
+#endif
#define INIT_SEGV \
do \
{ \
nullp = new java::lang::NullPointerException (); \
struct sigaction act; \
- act.sa_handler = _Jv_catch_segv; \
+ act.sa_sigaction = _Jv_catch_segv; \
sigemptyset (&act.sa_mask); \
- act.sa_flags = 0; \
+ act.sa_flags = SA_SIGINFO; \
syscall (SYS_sigaction, SIGSEGV, &act, NULL); \
} \
while (0)
@@ -55,9 +68,9 @@ do \
arithexception = new java::lang::ArithmeticException \
(JvNewStringLatin1 ("/ by zero")); \
struct sigaction act; \
- act.sa_handler = _Jv_catch_fpe; \
+ act.sa_sigaction = _Jv_catch_fpe; \
sigemptyset (&act.sa_mask); \
- act.sa_flags = 0; \
+ act.sa_flags = SA_SIGINFO; \
syscall (SYS_sigaction, SIGFPE, &act, NULL); \
} \
while (0)
diff --git a/libjava/include/i386-signal.h b/libjava/include/i386-signal.h
index dc3c1122c51..f89a0b16217 100644
--- a/libjava/include/i386-signal.h
+++ b/libjava/include/i386-signal.h
@@ -31,16 +31,11 @@ do \
void **_p = (void **)&_dummy; \
struct sigcontext_struct *_regs = (struct sigcontext_struct *)++_p; \
\
- register unsigned long _ebp = _regs->ebp; \
- register unsigned char *_eip = (unsigned char *)_regs->eip; \
- \
/* Advance the program counter so that it is after the start of the \
instruction: the x86 exception handler expects \
the PC to point to the instruction after a call. */ \
- _eip += 2; \
+ _regs->eip += 2; \
\
- asm volatile ("mov %0, (%%ebp); mov %1, 4(%%ebp)" \
- : : "r"(_ebp), "r"(_eip)); \
} \
while (0)
@@ -63,7 +58,7 @@ do \
* As the instructions are variable length it is necessary to do a \
* little calculation to figure out where the following instruction \
* actually is. \
- \
+ \
*/ \
\
if (_eip[0] == 0xf7) \
@@ -104,6 +99,9 @@ do \
\
_eip = (unsigned char *)_ebp[1]; \
_ebp = (unsigned long *)_ebp[0]; \
+ \
+ asm volatile ("mov %0, (%%ebp); mov %1, 4(%%ebp)" \
+ : : "r"(_ebp), "r"(_eip)); \
} \
else \
{ \
@@ -111,12 +109,9 @@ do \
of the instruction: this is because the x86 exception \
handler expects the PC to point to the instruction after a \
call. */ \
- _eip += 2; \
+ _regs->eip += 2; \
} \
} \
- \
- asm volatile ("mov %0, (%%ebp); mov %1, 4(%%ebp)" \
- : : "r"(_ebp), "r"(_eip)); \
} \
while (0)
diff --git a/libjava/include/ppc-signal.h b/libjava/include/ppc-signal.h
deleted file mode 100644
index 003a7604533..00000000000
--- a/libjava/include/ppc-signal.h
+++ /dev/null
@@ -1,115 +0,0 @@
-// ppc-signal.h - Catch runtime signals and turn them into exceptions.
-
-/* Copyright (C) 2000 Free Software Foundation
-
- This file is part of libgcj.
-
-This software is copyrighted work licensed under the terms of the
-Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
-details. */
-
-#ifndef JAVA_SIGNAL_H
-#define JAVA_SIGNAL_H 1
-
-#include <signal.h>
-#include <ucontext.h>
-
-#define HANDLE_SEGV 1
-#undef HANDLE_FPE
-
-#define SIGNAL_HANDLER(_name) \
-__asm ("\t.section\t\".text\"\n" \
- "\t.align 2\n" \
- "_Jv_" #_name ":\n" \
- "\tmr 3, 1\n" \
- "\tb _Jv_stub_" #_name "\n"); \
-extern "C" void _Jv_##_name (int _dummy); \
-extern "C" void _Jv_stub_##_name (char *_sp) \
-
-class java::lang::Throwable;
-
-// Unwind the stack to the point at which the signal was generated and
-// then throw an exception.
-
-#define MAKE_THROW_FRAME(_exception) \
-do \
-{ \
- struct sigcontext_struct *_context \
- = (struct sigcontext_struct *)(_sp + __SIGNAL_FRAMESIZE); \
- long int regs [34]; \
- memcpy (regs, &_context->regs->gpr[0], 32 * sizeof (long int)); \
- regs[32] = _context->regs->nip + sizeof (long int); \
- regs[33] = _context->regs->link; \
- \
- __asm volatile ( \
- "\tmr 31,%0\n" \
- "\tmr 3,%1 # exception to throw\n" \
- "\tlwz 0,128(31) # ip\n" \
- "\tmtlr 0\n" \
- "\tlwz 1,4(31) # previous r1\n" \
- "\tlwz 0,132(31) # previous lr\n" \
- "\tlwz 2,0(1) # previous previous r1\n" \
- "\tstw 0,4(2) # save previous lr\n" \
- "\tlwz 0,0(31)\n" \
- "\tlwz 2,8(31)\n" \
- "\tlwz 4,16(31)\n" \
- "\tlwz 5,20(31)\n" \
- "\tlwz 6,24(31)\n" \
- "\tlwz 7,28(31)\n" \
- "\tlwz 8,32(31)\n" \
- "\tlwz 9,36(31)\n" \
- "\tlwz 10,40(31)\n" \
- "\tlwz 11,44(31)\n" \
- "\tlwz 12,48(31)\n" \
- "\tlwz 13,52(31)\n" \
- "\tlwz 14,56(31)\n" \
- "\tlwz 15,60(31)\n" \
- "\tlwz 16,64(31)\n" \
- "\tlwz 17,68(31)\n" \
- "\tlwz 18,72(31)\n" \
- "\tlwz 19,76(31)\n" \
- "\tlwz 20,80(31)\n" \
- "\tlwz 21,84(31)\n" \
- "\tlwz 22,88(31)\n" \
- "\tlwz 23,92(31)\n" \
- "\tlwz 24,96(31)\n" \
- "\tlwz 25,100(31)\n" \
- "\tlwz 26,104(31)\n" \
- "\tlwz 27,108(31)\n" \
- "\tlwz 28,112(31)\n" \
- "\tlwz 29,116(31)\n" \
- "\tlwz 30,120(31)\n" \
- "\tlwz 31,124(31)\n" \
- "\tb _Jv_ThrowSignal\n" \
- : : "r"(regs), "r"(_exception) \
- : "r31", "r3"); \
-} \
-while (0)
-
-
-#define INIT_SEGV \
-do \
- { \
- nullp = new java::lang::NullPointerException (); \
- struct sigaction act; \
- act.sa_handler = _Jv_catch_segv; \
- sigemptyset (&act.sa_mask); \
- act.sa_flags = 0; \
- __sigaction (SIGSEGV, &act, NULL); \
- } \
-while (0)
-
-#define INIT_FPE \
-do \
- { \
- arithexception = new java::lang::ArithmeticException \
- (JvNewStringLatin1 ("/ by zero")); \
- struct sigaction act; \
- act.sa_handler = _Jv_catch_fpe; \
- sigemptyset (&act.sa_mask); \
- act.sa_flags = 0; \
- __sigaction (SIGFPE, &act, NULL); \
- } \
-while (0)
-
-#endif /* JAVA_SIGNAL_H */