Blame sysdeps/powerpc/novmxsetjmp.h

Packit 6c4009
/* Copyright (C) 1991-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
/* Copied from setjmp/setjmp.h, powerpc/bits/setjmp.h and modified
Packit 6c4009
   appropriately to keep backward compatible with setjmp without
Packit 6c4009
   AltiVec/VMX support.
Packit 6c4009
Packit 6c4009
   This file is not exported and the interfaces are private to libc.  */
Packit 6c4009
Packit 6c4009
#ifndef	__NOVMX_SETJMP_H
Packit 6c4009
#define	__NOVMX_SETJMP_H	1
Packit 6c4009
Packit 6c4009
#include <bits/wordsize.h>
Packit 6c4009
Packit 6c4009
/* The following definitions are needed by ASM implementations of the old
Packit 6c4009
   (novmx) __longjmp/__setjmp functions.  */
Packit 6c4009
Packit 6c4009
# define JB_GPR1   0  /* Also known as the stack pointer */
Packit 6c4009
# define JB_GPR2   1
Packit 6c4009
# define JB_LR     2  /* The address we will return to */
Packit 6c4009
# if __WORDSIZE == 64
Packit 6c4009
#  define JB_GPRS   3  /* GPRs 14 through 31 are saved, 18*2 words total.  */
Packit 6c4009
#  define JB_CR     21 /* Condition code registers. */
Packit 6c4009
#  define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total.  */
Packit 6c4009
#  define JB_SIZE   (40 * 8)
Packit 6c4009
# else
Packit 6c4009
#  define JB_GPRS   3  /* GPRs 14 through 31 are saved, 18 in total.  */
Packit 6c4009
#  define JB_CR     21 /* Condition code registers.  */
Packit 6c4009
#  define JB_FPRS   22 /* FPRs 14 through 31 are saved, 18*2 words total.  */
Packit 6c4009
#  define JB_SIZE   (58 * 4)
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
#ifndef	_ASM
Packit 6c4009
/* The following definitions are needed by the novmx* implementations of
Packit 6c4009
   setjmp/longjmp/sigsetjmp/etc that wrapper __setjmp/__longjmp.  */
Packit 6c4009
Packit 6c4009
# if __WORDSIZE == 64
Packit 6c4009
typedef long int __jmp_buf[40];
Packit 6c4009
# else
Packit 6c4009
typedef long int __jmp_buf[58];
Packit 6c4009
# endif
Packit 6c4009
Packit 6c4009
# include <bits/types/__sigset_t.h>
Packit 6c4009
Packit 6c4009
/* Calling environment, plus possibly a saved signal mask.  */
Packit 6c4009
typedef struct __novmx__jmp_buf_tag
Packit 6c4009
  {
Packit 6c4009
    /* NOTE: The machine-dependent definitions of `__sigsetjmp'
Packit 6c4009
       assume that a `jmp_buf' begins with a `__jmp_buf' and that
Packit 6c4009
       `__mask_was_saved' follows it.  Do not move these members
Packit 6c4009
       or add others before it.  */
Packit 6c4009
    __jmp_buf __jmpbuf;		/* Calling environment.  */
Packit 6c4009
    int __mask_was_saved;	/* Saved the signal mask?  */
Packit 6c4009
    __sigset_t __saved_mask;	/* Saved signal mask.  */
Packit 6c4009
  } __novmx__jmp_buf[1];
Packit 6c4009
Packit 6c4009
Packit 6c4009
/* Store the calling environment in ENV, also saving the signal mask.
Packit 6c4009
   Return 0.  */
Packit 6c4009
extern int __novmxsetjmp (__novmx__jmp_buf __env);
Packit 6c4009
Packit 6c4009
/* Store the calling environment in ENV, also saving the
Packit 6c4009
   signal mask if SAVEMASK is nonzero.  Return 0.
Packit 6c4009
   This is the internal name for `sigsetjmp'.  */
Packit 6c4009
extern int __novmx__sigsetjmp (struct __novmx__jmp_buf_tag __env[1],
Packit 6c4009
			       int __savemask);
Packit 6c4009
Packit 6c4009
/* Store the calling environment in ENV, not saving the signal mask.
Packit 6c4009
   Return 0.  */
Packit 6c4009
extern int __novmx_setjmp (struct __novmx__jmp_buf_tag __env[1]);
Packit 6c4009
Packit 6c4009
/* Jump to the environment saved in ENV, making the
Packit 6c4009
   `setjmp' call there return VAL, or 1 if VAL is 0.  */
Packit 6c4009
extern void __novmxlongjmp (struct __novmx__jmp_buf_tag __env[1], int __val)
Packit 6c4009
     __attribute__ ((__noreturn__));
Packit 6c4009
Packit 6c4009
/* Same.  Usually `_longjmp' is used with `_setjmp', which does not save
Packit 6c4009
   the signal mask.  But it is how ENV was saved that determines whether
Packit 6c4009
   `longjmp' restores the mask; `_longjmp' is just an alias.  */
Packit 6c4009
extern void __novmx_longjmp (struct __novmx__jmp_buf_tag __env[1], int __val)
Packit 6c4009
     __attribute__ ((__noreturn__));
Packit 6c4009
Packit 6c4009
/* Use the same type for `jmp_buf' and `sigjmp_buf'.
Packit 6c4009
   The `__mask_was_saved' flag determines whether
Packit 6c4009
   or not `longjmp' will restore the signal mask.  */
Packit 6c4009
typedef struct __novmx__jmp_buf_tag __novmx__sigjmp_buf[1];
Packit 6c4009
Packit 6c4009
/* Jump to the environment saved in ENV, making the
Packit 6c4009
   sigsetjmp call there return VAL, or 1 if VAL is 0.
Packit 6c4009
   Restore the signal mask if that sigsetjmp call saved it.
Packit 6c4009
   This is just an alias `longjmp'.  */
Packit 6c4009
extern void __novmxsiglongjmp (__novmx__sigjmp_buf __env, int __val)
Packit 6c4009
     __attribute__ ((__noreturn__));
Packit 6c4009
Packit 6c4009
/* Internal machine-dependent function to restore context sans signal mask.  */
Packit 6c4009
extern void __novmx__longjmp (__jmp_buf __env, int __val)
Packit 6c4009
     __attribute__ ((__noreturn__));
Packit 6c4009
Packit 6c4009
/* Internal function to possibly save the current mask of blocked signals
Packit 6c4009
   in ENV, and always set the flag saying whether or not it was saved.
Packit 6c4009
   This is used by the machine-dependent definition of `__sigsetjmp'.
Packit 6c4009
   Always returns zero, for convenience.  */
Packit 6c4009
extern int __novmx__sigjmp_save (__novmx__jmp_buf __env, int __savemask);
Packit 6c4009
Packit 6c4009
extern void _longjmp_unwind (__novmx__jmp_buf env, int val);
Packit 6c4009
Packit 6c4009
extern void __novmx__libc_siglongjmp (__novmx__sigjmp_buf env, int val)
Packit 6c4009
          __attribute__ ((noreturn));
Packit 6c4009
Packit 6c4009
extern void __novmx__libc_longjmp (__novmx__sigjmp_buf env, int val)
Packit 6c4009
     __attribute__ ((noreturn));
Packit 6c4009
Packit 6c4009
libc_hidden_proto (__novmx__libc_longjmp)
Packit 6c4009
libc_hidden_proto (__novmx_setjmp)
Packit 6c4009
libc_hidden_proto (__novmx__sigsetjmp)
Packit 6c4009
#endif /* !_ASM */
Packit 6c4009
Packit 6c4009
#endif