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