#ifndef _SYS_UCONTEXT_H
#define _SYS_UCONTEXT_H
#include <sys/feature_tests.h>
#include <sys/types.h>
#include <sys/mcontext.h>
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#include <sys/signal.h>
#endif
#ifdef __cplusplus
extern "C" {
#endif
#if defined(_XPG4_2) && !defined(__EXTENSIONS__)
#ifndef _SIGSET_T
#define _SIGSET_T
typedef struct {
unsigned int __sigbits[4];
} sigset_t;
#endif
#ifndef _STACK_T
#define _STACK_T
typedef struct {
void *ss_sp;
size_t ss_size;
int ss_flags;
} stack_t;
#endif
#endif
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
typedef struct ucontext ucontext_t;
#else
typedef struct __ucontext ucontext_t;
#endif
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
struct ucontext {
#else
struct __ucontext {
#endif
uint_t uc_flags;
ucontext_t *uc_link;
sigset_t uc_sigmask;
stack_t uc_stack;
mcontext_t uc_mcontext;
#ifdef __sparcv9
long uc_filler[4];
#else
long uc_filler[23];
#endif
};
#ifdef _SYSCALL32
typedef struct ucontext32 {
uint32_t uc_flags;
caddr32_t uc_link;
sigset_t uc_sigmask;
stack32_t uc_stack;
mcontext32_t uc_mcontext;
int32_t uc_filler[23];
} ucontext32_t;
#ifdef _KERNEL
extern void ucontext_32ton(const ucontext32_t *, ucontext_t *,
const struct fq32 *, struct _fq *);
extern void fpuregset_nto32(const fpregset_t *, fpregset32_t *, struct fq32 *);
#endif
#endif
#if !defined(_XPG4_2) || defined(__EXTENSIONS__)
#define GETCONTEXT 0
#define SETCONTEXT 1
#define GETUSTACK 2
#define SETUSTACK 3
#define UC_SIGMASK 0x01
#define UC_STACK 0x02
#define UC_CPU 0x04
#define UC_MAU 0x08
#define UC_FPU UC_MAU
#define UC_INTR 0x10
#define UC_ASR 0x20
#define UC_MCONTEXT (UC_CPU|UC_FPU|UC_ASR)
#define UC_ALL (UC_SIGMASK|UC_STACK|UC_MCONTEXT)
#endif
#ifdef _KERNEL
extern void savecontext(ucontext_t *, const k_sigset_t *);
extern void restorecontext(ucontext_t *);
#ifdef _SYSCALL32
extern void savecontext32(ucontext32_t *, const k_sigset_t *, struct fq32 *);
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif