]> git.saurik.com Git - apple/xnu.git/blob - bsd/ppc/signal.h
669158f49aa27bea9530e1826a8f1db93930f0c1
[apple/xnu.git] / bsd / ppc / signal.h
1 /*
2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23 /*
24 * Copyright (c) 1992, 1993 NeXT Computer, Inc.
25 */
26
27 #ifndef _PPC_SIGNAL_
28 #define _PPC_SIGNAL_ 1
29
30 #include <sys/appleapiopts.h>
31
32 #ifdef __APPLE_API_OBSOLETE
33 typedef int sig_atomic_t;
34
35 /*
36 * Machine-dependant flags used in sigvec call.
37 */
38 #define SV_SAVE_REGS 0x1000 /* Save all regs in sigcontext */
39
40 /*
41 * regs_saved_t -- Describes which registers beyond what the kernel cares
42 * about are saved to and restored from this sigcontext.
43 *
44 * The default is REGS_SAVED_CALLER, only the caller saved registers
45 * are saved. If the SV_SAVE_REGS flag was set when the signal
46 * handler was registered with sigvec() then all the registers will be
47 * saved in the sigcontext, and REGS_SAVED_ALL will be set. The C
48 * library uses REGS_SAVED_NONE in order to quickly restore kernel
49 * state during a longjmp().
50 */
51 typedef enum {
52 REGS_SAVED_NONE, /* Only kernel managed regs restored */
53 REGS_SAVED_CALLER, /* "Caller saved" regs: rpc, a0-a7,
54 t0-t4, at, lk0-lk1, xt1-xt20,
55 xr0-xr1 */
56 REGS_SAVED_ALL /* All registers */
57 } regs_saved_t;
58
59
60 /*
61 * Information pushed on stack when a signal is delivered.
62 * This is used by the kernel to restore state following
63 * execution of the signal handler. It is also made available
64 * to the handler to allow it to properly restore state if
65 * a non-standard exit is performed.
66 */
67 struct sigcontext32 {
68 int sc_onstack; /* sigstack state to restore */
69 int sc_mask; /* signal mask to restore */
70 int sc_ir; /* pc */
71 int sc_psw; /* processor status word */
72 int sc_sp; /* stack pointer if sc_regs == NULL */
73 void *sc_regs; /* (kernel private) saved state */
74 };
75
76 struct sigcontext64 {
77 int sc_onstack; /* sigstack state to restore */
78 int sc_mask; /* signal mask to restore */
79 long long sc_ir; /* pc */
80 long long sc_psw; /* processor status word */
81 long long sc_sp; /* stack pointer if sc_regs == NULL */
82 void *sc_regs; /* (kernel private) saved state */
83 };
84
85 /*
86 * LP64todo - Have to decide how to handle this.
87 * For now, just duplicate the 32-bit context as the generic one.
88 */
89 struct sigcontext {
90 int sc_onstack; /* sigstack state to restore */
91 int sc_mask; /* signal mask to restore */
92 int sc_ir; /* pc */
93 int sc_psw; /* processor status word */
94 int sc_sp; /* stack pointer if sc_regs == NULL */
95 void *sc_regs; /* (kernel private) saved state */
96 };
97
98 #endif /* __APPLE_API_OBSOLETE */
99
100 #endif /* _PPC_SIGNAL_ */
101