home *** CD-ROM | disk | FTP | other *** search
/ H4CK3R 4 / hacker04 / 04_HACK04.ISO / darwin / darwinx86.iso / usr / include / ppc / setjmp.h < prev    next >
Encoding:
C/C++ Source or Header  |  2001-09-30  |  2.4 KB  |  78 lines

  1. /*
  2.  * Copyright (c) 2000 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. /* Copyright (c) 1998 Apple Computer, Inc.  All rights reserved.
  23.  *
  24.  *    File:    ppc/setjmp.h
  25.  *
  26.  *    Declaration of setjmp routines and data structures.
  27.  */
  28. #ifndef _BSD_PPC_SETJMP_H_
  29. #define _BSD_PPC_SETJMP_H_
  30.  
  31. #include <sys/cdefs.h>
  32. #include <machine/signal.h>
  33.  
  34. struct _jmp_buf {
  35.     struct sigcontext    sigcontext; /* kernel state preserved by set/longjmp */
  36.     unsigned long vmask __attribute__((aligned(8))); /* vector mask register */
  37.     unsigned long vreg[32 * 4] __attribute__((aligned(16)));
  38.         /* 32 128-bit vector registers */
  39. };
  40.  
  41. /*
  42.  *    _JBLEN is number of ints required to save the following:
  43.  *    r1, r2, r13-r31, lr, cr, ctr, xer, sig  == 26 ints
  44.  *    fr14 -  fr31 = 18 doubles = 36 ints
  45.  *    vmask, 32 vector registers = 129 ints
  46.  *    2 ints to get all the elements aligned 
  47.  */
  48.  
  49. #define _JBLEN (26 + 36 + 129 + 1)
  50.  
  51. #if defined(KERNEL)
  52. typedef struct sigcontext jmp_buf[1];
  53. typedef struct __sigjmp_buf {
  54.         int __storage[_JBLEN + 1] __attribute__((aligned(8)));
  55.         } sigjmp_buf[1];
  56. #else
  57. typedef int jmp_buf[_JBLEN];
  58. typedef int sigjmp_buf[_JBLEN + 1];
  59. #endif
  60.  
  61. __BEGIN_DECLS
  62. extern int setjmp __P((jmp_buf env));
  63. extern void longjmp __P((jmp_buf env, int val));
  64.  
  65. #ifndef _ANSI_SOURCE
  66. int sigsetjmp __P((sigjmp_buf env, int val));
  67. void siglongjmp __P((sigjmp_buf env, int val));
  68. #endif /* _ANSI_SOURCE  */
  69.  
  70. #if !defined(_ANSI_SOURCE) && !defined(_POSIX_SOURCE)
  71. int    _setjmp __P((jmp_buf env));
  72. void    _longjmp __P((jmp_buf, int val));
  73. void    longjmperror __P((void));
  74. #endif /* neither ANSI nor POSIX */
  75. __END_DECLS
  76.  
  77. #endif /* !_BSD_PPC_SETJMP_H_ */
  78.