2 * Copyright (c) 2000-2004 Apple Computer, Inc. All rights reserved.
4 * @APPLE_LICENSE_HEADER_START@
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.
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
20 * @APPLE_LICENSE_HEADER_END@
22 /* Copyright (c) 1998 Apple Computer, Inc. All rights reserved.
26 * Declaration of setjmp routines and data structures.
28 #ifndef _BSD_PPC_SETJMP_H_
29 #define _BSD_PPC_SETJMP_H_
31 #include <sys/cdefs.h>
32 #include <machine/signal.h>
35 struct sigcontext sigcontext
; /* kernel state preserved by set/longjmp */
36 unsigned int vmask
__attribute__((aligned(8))); /* vector mask register */
37 unsigned int vreg
[32 * 4] __attribute__((aligned(16)));
38 /* 32 128-bit vector registers */
42 * _JBLEN is number of ints required to save the following:
43 * r1, r2, r13-r31, lr, cr, ctr, xer, sig == 26 register_t sized
44 * fr14 - fr31 = 18 doubles
45 * vmask, 32 vector registers = 129 ints
46 * 2 ints to get all the elements aligned
48 * register_t is 2 ints for ppc64 threads
50 #define _JBLEN64 (26*2 + 18*2 + 129 + 1)
51 #define _JBLEN32 (26 + 18*2 + 129 + 1)
52 #define _JBLEN_MAX _JBLEN64
55 * Locally scoped sizes
57 #if defined(__ppc64__)
58 #define _JBLEN _JBLEN64
60 #define _JBLEN _JBLEN32
64 typedef struct sigcontext32 jmp_buf32
[1];
65 typedef struct __sigjmp_buf32
{
66 int __storage
[_JBLEN32
+ 1] __attribute__((aligned(8)));
69 typedef struct sigcontext64 jmp_buf64
[1];
70 typedef struct __sigjmp_buf64
{
71 int __storage
[_JBLEN64
+ 1] __attribute__((aligned(8)));
75 * JMM - have to decide how the kernel will deal with this.
76 * For now, hard-code the 32-bit types.
78 typedef struct sigcontext32
jmp_buf[1];
79 typedef struct __sigjmp_buf32 sigjmp_buf
[1];
82 typedef int jmp_buf[_JBLEN
];
83 typedef int sigjmp_buf
[_JBLEN
+ 1];
87 extern int setjmp(jmp_buf env
);
88 extern void longjmp(jmp_buf env
, int val
);
91 int _setjmp(jmp_buf env
);
92 void _longjmp(jmp_buf, int val
);
93 int sigsetjmp(sigjmp_buf env
, int val
);
94 void siglongjmp(sigjmp_buf env
, int val
);
95 #endif /* _ANSI_SOURCE */
97 #if !defined(_ANSI_SOURCE) && !defined(_POSIX_C_SOURCE)
98 void longjmperror(void);
99 #endif /* neither ANSI nor POSIX */
102 #endif /* !_BSD_PPC_SETJMP_H_ */