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