OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [include/] [powerpc-signal.h] - Blame information for rev 790

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 757 jeremybenn
// powerpc-signal.h - Catch runtime signals and turn them into exceptions
2
// on a powerpc based Linux system.
3
 
4
/* Copyright (C) 2003, 2006  Free Software Foundation
5
 
6
   This file is part of libgcj.
7
 
8
This software is copyrighted work licensed under the terms of the
9
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
10
details.  */
11
 
12
 
13
#ifndef JAVA_SIGNAL_H
14
#define JAVA_SIGNAL_H 1
15
 
16
#include <signal.h>
17
#include <sys/syscall.h>
18
 
19
#define HANDLE_SEGV 1
20
#undef HANDLE_FPE
21
 
22
#define SIGNAL_HANDLER(_name)                                           \
23
  static void _name (int /* _signal */, struct sigcontext *_sc)
24
 
25
/* MD_FALLBACK_FRAME_STATE_FOR takes care of special casing PC
26
   before the faulting instruction, so we don't need to do anything
27
   here.  */
28
 
29
#define MAKE_THROW_FRAME(_exception)
30
 
31
/* For an explanation why we cannot simply use sigaction to
32
   install the handlers, see i386-signal.h.  */
33
 
34
/* We use kernel_old_sigaction here because we're calling the kernel
35
   directly rather than via glibc. The sigaction structure that the
36
   syscall uses is a different shape from the one in userland and not
37
   visible to us in a header file so we define it here.
38
   Additionally we want a proper prototype for the handler function
39
   with the struct sigcontext pointer passed by the kernel as the 2nd
40
   argument, which isn't there in userland headers.
41
 
42
   Note that we explicitly avoid the SA_SIGINFO flag in INIT_SEGV and
43
   INIT_FPE below. Using the ucontext pointer passed as 3rd argument
44
   of a SA_SIGINFO type handler would need complicated backwards
45
   compatibility hacks in MAKE_THROW_FRAME, as the ucontext layout
46
   on PPC changed during the 2.5 kernel series.  */
47
 
48
#ifndef __powerpc64__
49
struct kernel_old_sigaction {
50
  void (*k_sa_handler) (int, struct sigcontext *);
51
  unsigned long k_sa_mask;
52
  unsigned long k_sa_flags;
53
  void (*k_sa_restorer) (void);
54
};
55
 
56
#define INIT_SEGV                                                       \
57
do                                                                      \
58
  {                                                                     \
59
    struct kernel_old_sigaction kact;                                   \
60
    kact.k_sa_handler = catch_segv;                                     \
61
    kact.k_sa_mask = 0;                                                  \
62
    kact.k_sa_flags = 0;                                         \
63
    if (syscall (SYS_sigaction, SIGSEGV, &kact, NULL) != 0)              \
64
      __asm__ __volatile__ (".long 0");                                 \
65
  }                                                                     \
66
while (0)
67
 
68
#define INIT_FPE                                                        \
69
do                                                                      \
70
  {                                                                     \
71
    struct kernel_old_sigaction kact;                                   \
72
    kact.k_sa_handler = catch_fpe;                                      \
73
    kact.k_sa_mask = 0;                                                  \
74
    kact.k_sa_flags = 0;                                         \
75
    if (syscall (SYS_sigaction, SIGFPE, &kact, NULL) != 0)               \
76
      __asm__ __volatile__ (".long 0");                                 \
77
  }                                                                     \
78
while (0)
79
 
80
#else /* powerpc64 */
81
 
82
struct kernel_sigaction
83
{
84
  void (*k_sa_handler) (int, struct sigcontext *);
85
  unsigned long k_sa_flags;
86
  void (*k_sa_restorer)(void);
87
  unsigned long k_sa_mask;
88
};
89
 
90
#define INIT_SEGV                                                       \
91
do                                                                      \
92
  {                                                                     \
93
    struct kernel_sigaction kact;                                       \
94
    memset (&kact, 0, sizeof (kact));                                    \
95
    kact.k_sa_handler = catch_segv;                                     \
96
    if (syscall (SYS_rt_sigaction, SIGSEGV, &kact, NULL, 8) != 0)        \
97
      __asm__ __volatile__ (".long 0");                                 \
98
  }                                                                     \
99
while (0)
100
 
101
#define INIT_FPE                                                        \
102
do                                                                      \
103
  {                                                                     \
104
    struct kernel_sigaction kact;                                       \
105
    memset (&kact, 0, sizeof (kact));                                    \
106
    kact.k_sa_handler = catch_fpe;                                      \
107
    if (syscall (SYS_rt_sigaction, SIGFPE, &kact, NULL, 8) != 0) \
108
      __asm__ __volatile__ (".long 0");                                 \
109
  }                                                                     \
110
while (0)
111
#endif
112
 
113
#endif /* JAVA_SIGNAL_H */

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.