2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
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 License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
28 /* Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
32 * Declaration of setjmp routines and data structures.
34 #ifndef _BSD_PPC_SETJMP_H_
35 #define _BSD_PPC_SETJMP_H_
37 #include <sys/cdefs.h>
38 #include <machine/signal.h>
41 struct sigcontext sigcontext
; /* kernel state preserved by set/longjmp */
42 unsigned int vmask
__attribute__((aligned(8))); /* vector mask register */
43 unsigned int vreg
[32 * 4] __attribute__((aligned(16)));
44 /* 32 128-bit vector registers */
48 * _JBLEN is number of ints required to save the following:
49 * r1, r2, r13-r31, lr, cr, ctr, xer, sig == 26 register_t sized
50 * fr14 - fr31 = 18 doubles
51 * vmask, 32 vector registers = 129 ints
52 * 2 ints to get all the elements aligned
54 * register_t is 2 ints for ppc64 threads
56 #define _JBLEN64 (26*2 + 18*2 + 129 + 1)
57 #define _JBLEN32 (26 + 18*2 + 129 + 1)
58 #define _JBLEN_MAX _JBLEN64
61 * Locally scoped sizes
63 #if defined(__ppc64__)
64 #define _JBLEN _JBLEN64
66 #define _JBLEN _JBLEN32
70 typedef struct sigcontext32 jmp_buf32
[1];
71 typedef struct __sigjmp_buf32
{
72 int __storage
[_JBLEN32
+ 1] __attribute__((aligned(8)));
75 typedef struct sigcontext64 jmp_buf64
[1];
76 typedef struct __sigjmp_buf64
{
77 int __storage
[_JBLEN64
+ 1] __attribute__((aligned(8)));
81 * JMM - have to decide how the kernel will deal with this.
82 * For now, hard-code the 32-bit types.
84 typedef struct sigcontext32
jmp_buf[1];
85 typedef struct __sigjmp_buf32 sigjmp_buf
[1];
88 typedef int jmp_buf[_JBLEN
];
89 typedef int sigjmp_buf
[_JBLEN
+ 1];
93 extern int setjmp(jmp_buf env
);
94 extern void longjmp(jmp_buf env
, int val
);
97 int _setjmp(jmp_buf env
);
98 void _longjmp(jmp_buf, int val
);
99 int sigsetjmp(sigjmp_buf env
, int val
);
100 void siglongjmp(sigjmp_buf env
, int val
);
101 #endif /* _ANSI_SOURCE */
103 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
104 void longjmperror(void);
105 #endif /* neither ANSI nor POSIX */
108 #endif /* !_BSD_PPC_SETJMP_H_ */