| 1 | /* |
| 2 | * Copyright (c) 1986, 1989, 1991, 1993 |
| 3 | * The Regents of the University of California. All rights reserved. |
| 4 | * |
| 5 | * Redistribution and use in source and binary forms, with or without |
| 6 | * modification, are permitted provided that the following conditions |
| 7 | * are met: |
| 8 | * 1. Redistributions of source code must retain the above copyright |
| 9 | * notice, this list of conditions and the following disclaimer. |
| 10 | * 2. Redistributions in binary form must reproduce the above copyright |
| 11 | * notice, this list of conditions and the following disclaimer in the |
| 12 | * documentation and/or other materials provided with the distribution. |
| 13 | * 3. All advertising materials mentioning features or use of this software |
| 14 | * must display the following acknowledgement: |
| 15 | * This product includes software developed by the University of |
| 16 | * California, Berkeley and its contributors. |
| 17 | * 4. Neither the name of the University nor the names of its contributors |
| 18 | * may be used to endorse or promote products derived from this software |
| 19 | * without specific prior written permission. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | * SUCH DAMAGE. |
| 32 | * |
| 33 | * @(#)signal.h 8.1 (Berkeley) 6/11/93 |
| 34 | * $FreeBSD: src/sys/i386/include/signal.h,v 1.12 1999/11/12 13:52:11 marcel Exp $ |
| 35 | * $DragonFly: src/sys/cpu/amd64/include/signal.h,v 1.2 2008/08/25 23:34:31 dillon Exp $ |
| 36 | */ |
| 37 | |
| 38 | #ifndef _CPU_SIGNAL_H_ |
| 39 | #define _CPU_SIGNAL_H_ |
| 40 | |
| 41 | /** si_code **/ |
| 42 | /* codes for SIGILL */ |
| 43 | #define ILL_ILLOPC 1 /* Illegal opcode. */ |
| 44 | #define ILL_ILLOPN 2 /* Illegal operand. */ |
| 45 | #define ILL_ILLADR 3 /* Illegal addressing mode. */ |
| 46 | #define ILL_ILLTRP 4 /* Illegal trap. */ |
| 47 | #define ILL_PRVOPC 5 /* Privileged opcode. */ |
| 48 | #define ILL_PRVREG 6 /* Privileged register. */ |
| 49 | #define ILL_COPROC 7 /* Coprocessor error. */ |
| 50 | #define ILL_BADSTK 8 /* Internal stack error. */ |
| 51 | |
| 52 | /* codes for SIGBUS */ |
| 53 | #define BUS_ADRALN 1 /* Invalid address alignment. */ |
| 54 | #define BUS_ADRERR 2 /* Nonexistent physical address. */ |
| 55 | #define BUS_OBJERR 3 /* Object-specific hardware error. */ |
| 56 | |
| 57 | /* codes for SIGSEGV */ |
| 58 | #define SEGV_MAPERR 1 /* Address not mapped to object. */ |
| 59 | #define SEGV_ACCERR 2 /* Invalid permissions for mapped */ |
| 60 | /* object. */ |
| 61 | |
| 62 | /* codes for SIGFPE */ |
| 63 | #define FPE_INTOVF 1 /* Integer overflow. */ |
| 64 | #define FPE_INTDIV 2 /* Integer divide by zero. */ |
| 65 | #define FPE_FLTDIV 3 /* Floating point divide by zero. */ |
| 66 | #define FPE_FLTOVF 4 /* Floating point overflow. */ |
| 67 | #define FPE_FLTUND 5 /* Floating point underflow. */ |
| 68 | #define FPE_FLTRES 6 /* Floating point inexact result. */ |
| 69 | #define FPE_FLTINV 7 /* Invalid floating point operation. */ |
| 70 | #define FPE_FLTSUB 8 /* Subscript out of range. */ |
| 71 | |
| 72 | /* codes for SIGTRAP */ |
| 73 | #define TRAP_BRKPT 1 /* Process breakpoint. */ |
| 74 | #define TRAP_TRACE 2 /* Process trace trap. */ |
| 75 | |
| 76 | /* codes for SIGCHLD */ |
| 77 | #define CLD_EXITED 1 /* Child has exited */ |
| 78 | #define CLD_KILLED 2 /* Child has terminated abnormally but */ |
| 79 | /* did not create a core file */ |
| 80 | #define CLD_DUMPED 3 /* Child has terminated abnormally and */ |
| 81 | /* created a core file */ |
| 82 | #define CLD_TRAPPED 4 /* Traced child has trapped */ |
| 83 | #define CLD_STOPPED 5 /* Child has stopped */ |
| 84 | #define CLD_CONTINUED 6 /* Stopped child has continued */ |
| 85 | |
| 86 | /* codes for SIGPOLL */ |
| 87 | #define POLL_IN 1 /* Data input available */ |
| 88 | #define POLL_OUT 2 /* Output buffers available */ |
| 89 | #define POLL_MSG 3 /* Input message available */ |
| 90 | #define POLL_ERR 4 /* I/O Error */ |
| 91 | #define POLL_PRI 5 /* High priority input available */ |
| 92 | #define POLL_HUP 4 /* Device disconnected */ |
| 93 | |
| 94 | /* |
| 95 | * Machine-dependent signal definitions |
| 96 | */ |
| 97 | |
| 98 | typedef int sig_atomic_t; |
| 99 | |
| 100 | #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE) |
| 101 | |
| 102 | /* |
| 103 | * XXX temporarily use a <machine/bla.h> path instead of "bla.h" so the |
| 104 | * XFree86-4-clients port, which uses -I-, builds. Use of -I- should |
| 105 | * be banned, or the option should be fixed to not screw up relative-path |
| 106 | * includes. |
| 107 | */ |
| 108 | #include <machine/trap.h> /* codes for SIGILL, SIGFPE */ |
| 109 | |
| 110 | /* |
| 111 | * Information pushed on stack when a signal is delivered. |
| 112 | * This is used by the kernel to restore state following |
| 113 | * execution of the signal handler. It is also made available |
| 114 | * to the handler to allow it to restore state properly if |
| 115 | * a non-standard exit is performed. |
| 116 | * |
| 117 | * The sequence of the fields/registers in struct sigcontext should match |
| 118 | * those in mcontext_t. |
| 119 | */ |
| 120 | struct sigcontext { |
| 121 | sigset_t sc_mask; /* signal mask to restore */ |
| 122 | long sc_onstack; /* sigstack state to restore */ |
| 123 | long sc_rdi; |
| 124 | long sc_rsi; |
| 125 | long sc_rdx; |
| 126 | long sc_rcx; |
| 127 | long sc_r8; |
| 128 | long sc_r9; |
| 129 | long sc_rax; |
| 130 | long sc_rbx; |
| 131 | long sc_rbp; |
| 132 | long sc_r10; |
| 133 | long sc_r11; |
| 134 | long sc_r12; |
| 135 | long sc_r13; |
| 136 | long sc_r14; |
| 137 | long sc_r15; |
| 138 | long sc_trapno; |
| 139 | long sc_addr; |
| 140 | long sc_flags; |
| 141 | long sc_err; |
| 142 | long sc_rip; |
| 143 | long sc_cs; |
| 144 | long sc_rflags; |
| 145 | long sc_rsp; |
| 146 | long sc_ss; |
| 147 | long sc_len; |
| 148 | /* |
| 149 | * XXX - taken from freebsd |
| 150 | */ |
| 151 | long sc_fpformat; |
| 152 | long sc_ownedfp; |
| 153 | long sc_fpstate[64] __aligned(16); |
| 154 | long sc_spare[9]; |
| 155 | }; |
| 156 | |
| 157 | #endif /* !_ANSI_SOURCE && !_POSIX_SOURCE */ |
| 158 | |
| 159 | #endif /* !_CPU_SIGNAL_H_ */ |