00001 /* clib/include/setjmp.h 00002 * 00003 * ABLE {set,long}jmp interface for C exception management. 00004 * ABLE supports pluggable {set,long}jmp implementations based on the 00005 * type of processor found at runtime. 00006 * 00007 * Copyright 2003 Simtec Electronics 00008 * 00009 * Permission is hereby granted, free of charge, to any person 00010 * obtaining a copy of this software and associated documentation 00011 * files (the "Software"), to deal in the Software without 00012 * restriction, including without limitation the rights to use, copy, 00013 * modify, merge, publish, distribute, sublicense, and/or sell copies 00014 * of the Software, and to permit persons to whom the Software is 00015 * furnished to do so, subject to the following conditions: 00016 * 00017 * The above copyright notice and this permission notice shall be 00018 * included in all copies or substantial portions of the Software. 00019 * 00020 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 00021 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 00022 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 00023 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS 00024 * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN 00025 * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 00026 * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 00027 * SOFTWARE. 00028 * 00029 */ 00030 00031 #ifndef _ABLE_CLIB_SETJMP_H 00032 #define _ABLE_CLIB_SETJMP_H 1 00033 00034 #ifndef __ASSEMBLY__ 00035 /* allow 96 words for jump buffer */ 00036 00037 typedef int jmp_buf[ 96 ]; 00038 00039 extern int setjmp(jmp_buf env); 00040 extern void longjmp(jmp_buf env, int val); 00041 00042 /* setjmp_imp_s 00043 * 00044 * structure used by implementing routines for setjmp/longjmp handlers 00045 */ 00046 00047 typedef struct setjmp_imp_s { 00048 void (*longjmp)(void *, int val); 00049 int (*setjmp)(void *); 00050 00051 int bufsize; 00052 } setjmp_imp_t; 00053 00054 extern const setjmp_imp_t *setjmp_imp; 00055 00056 #endif /* __ASSEMBLY__ */ 00057 00058 /* magic to indicate that the jump-buffer is correct */ 00059 #define JMPBUF_MAGIC (void *)(0x42504d4a) 00060 00061 #endif /* _ABLE_CLIB_SETJMP_H */