source: vendor/gcc/3.3.4/libjava/include/sparc-signal.h

Last change on this file was 2, checked in by bird, 22 years ago

Initial revision

  • Property cvs2svn:cvs-rev set to 1.1
  • Property svn:eol-style set to native
  • Property svn:executable set to *
File size: 1.8 KB
Line 
1// sparc-signal.h - Catch runtime signals and turn them into exceptions.
2
3/* Copyright (C) 1998, 1999, 2000 Free Software Foundation
4
5 This file is part of libgcj.
6
7This software is copyrighted work licensed under the terms of the
8Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9details. */
10
11#ifndef JAVA_SIGNAL_H
12#define JAVA_SIGNAL_H 1
13
14#include <signal.h>
15#include <ucontext.h>
16
17#define HANDLE_SEGV 1
18#define HANDLE_FPE 1
19
20#define SIGNAL_HANDLER(_name) \
21static void _name (int _dummy, siginfo_t *_info, void *arg)
22
23#ifdef __arch64__
24#define FLUSH_REGISTER_WINDOWS \
25 asm volatile ("flushw");
26#else
27#define FLUSH_REGISTER_WINDOWS \
28 asm volatile ("ta 3");
29#endif
30
31#define MAKE_THROW_FRAME(_exception) \
32do \
33{ \
34 ucontext_t *_context = (ucontext_t *) arg; \
35 (void)_dummy; \
36 (void)_info; \
37 register long sp = _context->uc_mcontext.gregs[REG_SP]; \
38 register long retaddr = _context->uc_mcontext.gregs[REG_O7]; \
39 FLUSH_REGISTER_WINDOWS; \
40 asm volatile ("mov %0, %%i6; mov %1, %%i7" \
41 : : "r"(sp), "r"(retaddr)); \
42} \
43while (0)
44
45#define INIT_SEGV \
46do \
47 { \
48 nullp = new java::lang::NullPointerException (); \
49 struct sigaction act; \
50 act.sa_sigaction = catch_segv; \
51 act.sa_flags = SA_SIGINFO | SA_NODEFER; \
52 sigemptyset (&act.sa_mask); \
53 sigaction (SIGSEGV, &act, NULL); \
54 } \
55while (0)
56
57#define INIT_FPE \
58do \
59 { \
60 arithexception = new java::lang::ArithmeticException \
61 (JvNewStringLatin1 ("/ by zero")); \
62 struct sigaction act; \
63 act.sa_flags = SA_SIGINFO | SA_NODEFER; \
64 act.sa_sigaction = catch_fpe; \
65 sigemptyset (&act.sa_mask); \
66 sigaction (SIGFPE, &act, NULL); \
67 } \
68while (0)
69
70#endif /* JAVA_SIGNAL_H */
Note: See TracBrowser for help on using the repository browser.