setjmp.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
  2. This file is part of the GNU C Library.
  3. The GNU C Library is free software; you can redistribute it and/or
  4. modify it under the terms of the GNU Library General Public License as
  5. published by the Free Software Foundation; either version 2 of the
  6. License, or (at your option) any later version.
  7. The GNU C Library is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  10. Library General Public License for more details.
  11. You should have received a copy of the GNU Library General Public
  12. License along with the GNU C Library; see the file COPYING.LIB. If not,
  13. write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  14. Boston, MA 02111-1307, USA. */
  15. /* Define the machine-dependent type `jmp_buf'. m68k version. */
  16. #ifndef _SETJMP_H
  17. # error "Never include <bits/setjmp.h> directly; use <setjmp.h> instead."
  18. #endif
  19. #include <signal.h>
  20. typedef struct
  21. {
  22. /* There are eight 4-byte data registers, but D0 is not saved. */
  23. long int __dregs[7];
  24. /* There are six 4-byte address registers, plus the FP and SP. */
  25. int *__aregs[6];
  26. int *__fp;
  27. int *__sp;
  28. #if defined __HAVE_68881__ || defined __HAVE_FPU__
  29. /* There are eight floating point registers which
  30. are saved in IEEE 96-bit extended format. */
  31. char __fpregs[8 * (96 / 8)];
  32. #endif
  33. } __jmp_buf[1];
  34. /* Test if longjmp to JMPBUF would unwind the frame
  35. containing a local variable at ADDRESS. */
  36. #define _JMPBUF_UNWINDS(jmpbuf, address) \
  37. ((void *) (address) < (void *) (jmpbuf)->__sp)
  38. /* Simple version of sigsetjmp and siglongjmp */
  39. __BEGIN_DECLS
  40. extern int __setjmp(__jmp_buf __buf);
  41. extern int __longjmp(__jmp_buf __buf, int __val);
  42. __END_DECLS
  43. #define longjmp(buf, val) __longjmp(buf, val)
  44. #define __sigsetjmp(env, savesigs) ((env)->__mask_was_saved = (savesigs), \
  45. sigprocmask(SIG_SETMASK, 0, &(env)->__saved_mask), \
  46. __setjmp((env)->__jmpbuf))
  47. #define siglongjmp(env, val) (((env)->__mask_was_saved ? \
  48. sigprocmask(SIG_SETMASK, &(env)->__saved_mask, 0) : 0), \
  49. __longjmp((env)->__jmpbuf, val))