2 * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved.
4 * @APPLE_LICENSE_OSREFERENCE_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
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
16 * Please obtain a copy of the License at
17 * http://www.opensource.apple.com/apsl/ and read it before using this
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.
28 * @APPLE_LICENSE_OSREFERENCE_HEADER_END@
30 /* Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
34 * Declaration of setjmp routines and data structures.
36 #ifndef _BSD_PPC_SETJMP_H_
37 #define _BSD_PPC_SETJMP_H_
39 #include <sys/cdefs.h>
40 #include <machine/signal.h>
43 struct sigcontext sigcontext
; /* kernel state preserved by set/longjmp */
44 unsigned int vmask
__attribute__((aligned(8))); /* vector mask register */
45 unsigned int vreg
[32 * 4] __attribute__((aligned(16)));
46 /* 32 128-bit vector registers */
50 * _JBLEN is number of ints required to save the following:
51 * r1, r2, r13-r31, lr, cr, ctr, xer, sig == 26 register_t sized
52 * fr14 - fr31 = 18 doubles
53 * vmask, 32 vector registers = 129 ints
54 * 2 ints to get all the elements aligned
56 * register_t is 2 ints for ppc64 threads
58 #define _JBLEN64 (26*2 + 18*2 + 129 + 1)
59 #define _JBLEN32 (26 + 18*2 + 129 + 1)
60 #define _JBLEN_MAX _JBLEN64
63 * Locally scoped sizes
65 #if defined(__ppc64__)
66 #define _JBLEN _JBLEN64
68 #define _JBLEN _JBLEN32
72 typedef struct sigcontext32 jmp_buf32
[1];
73 typedef struct __sigjmp_buf32
{
74 int __storage
[_JBLEN32
+ 1] __attribute__((aligned(8)));
77 typedef struct sigcontext64 jmp_buf64
[1];
78 typedef struct __sigjmp_buf64
{
79 int __storage
[_JBLEN64
+ 1] __attribute__((aligned(8)));
83 * JMM - have to decide how the kernel will deal with this.
84 * For now, hard-code the 32-bit types.
86 typedef struct sigcontext32
jmp_buf[1];
87 typedef struct __sigjmp_buf32 sigjmp_buf
[1];
90 typedef int jmp_buf[_JBLEN
];
91 typedef int sigjmp_buf
[_JBLEN
+ 1];
95 extern int setjmp(jmp_buf env
);
96 extern void longjmp(jmp_buf env
, int val
);
99 int _setjmp(jmp_buf env
);
100 void _longjmp(jmp_buf, int val
);
101 int sigsetjmp(sigjmp_buf env
, int val
);
102 void siglongjmp(sigjmp_buf env
, int val
);
103 #endif /* _ANSI_SOURCE */
105 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
106 void longjmperror(void);
107 #endif /* neither ANSI nor POSIX */
110 #endif /* !_BSD_PPC_SETJMP_H_ */