Home | History | Annotate | Line # | Download | only in include
mcontext.h revision 1.10
      1  1.10  kamil /*	$NetBSD: mcontext.h,v 1.10 2018/02/27 11:26:39 kamil Exp $	*/
      2   1.1    chs 
      3   1.1    chs #ifndef _HPPA_MCONTEXT_H_
      4   1.3    chs #define	_HPPA_MCONTEXT_H_
      5   1.1    chs 
      6   1.3    chs /*
      7   1.3    chs  * General register state
      8   1.3    chs  */
      9   1.3    chs #define	_NGREG		44
     10   1.3    chs 
     11   1.3    chs #define	_REG_PSW	0
     12   1.3    chs #define	_REG_RP		2
     13   1.3    chs #define	_REG_R19	19
     14   1.3    chs #define	_REG_ARG0	26
     15   1.3    chs #define	_REG_DP		27
     16   1.3    chs #define	_REG_RET0	28
     17   1.3    chs #define	_REG_SP		30
     18   1.3    chs #define	_REG_SAR	32
     19   1.3    chs #define	_REG_PCSQH	33
     20   1.3    chs #define	_REG_PCSQT	34
     21   1.3    chs #define	_REG_PCOQH	35
     22   1.3    chs #define	_REG_PCOQT	36
     23   1.3    chs #define	_REG_SR0	37
     24   1.3    chs #define	_REG_SR1	38
     25   1.3    chs #define	_REG_SR2	39
     26   1.3    chs #define	_REG_SR3	40
     27   1.3    chs #define	_REG_SR4	41
     28   1.3    chs #define	_REG_CR26	42
     29   1.3    chs #define	_REG_CR27	43
     30   1.3    chs 
     31   1.3    chs #ifndef __ASSEMBLER__
     32   1.3    chs 
     33   1.3    chs typedef	unsigned long	__greg_t;
     34   1.3    chs typedef	__greg_t	__gregset_t[_NGREG];
     35   1.3    chs 
     36   1.3    chs /*
     37   1.3    chs  * Floating point register state
     38   1.3    chs  */
     39   1.3    chs 
     40   1.3    chs typedef struct {
     41   1.3    chs 	union {
     42   1.3    chs 		unsigned long long	__fp_regs[32];
     43   1.3    chs 		double			__fp_dregs[32];
     44   1.3    chs 	}	__fp_fr;
     45   1.3    chs } __fpregset_t;
     46   1.3    chs 
     47   1.3    chs typedef struct {
     48   1.3    chs 	__gregset_t	__gregs;
     49   1.3    chs 	__fpregset_t	__fpregs;
     50   1.1    chs } mcontext_t;
     51   1.1    chs 
     52   1.3    chs #define	_UC_MACHINE_SP(uc)	((uc)->uc_mcontext.__gregs[_REG_SP])
     53   1.9  kamil #define	_UC_MACHINE_FP(uc)	((uc)->uc_mcontext.__gregs[3])
     54   1.3    chs #define	_UC_MACHINE_PC(uc) 	((uc)->uc_mcontext.__gregs[_REG_PCOQH])
     55   1.3    chs #define	_UC_MACHINE_SET_PC(uc, pc)					\
     56   1.3    chs do {									\
     57   1.3    chs 	(uc)->uc_mcontext.__gregs[_REG_PCOQH] = (pc);			\
     58   1.3    chs 	(uc)->uc_mcontext.__gregs[_REG_PCOQT] = (pc) + 4;		\
     59   1.3    chs } while (/*CONSTCOND*/0)
     60  1.10  kamil #define	_UC_MACHINE_INTRV(uc) 	((uc)->uc_mcontext.__gregs[_REG_RET0])
     61   1.3    chs 
     62   1.6  joerg static __inline void *
     63   1.5  joerg __lwp_getprivate_fast(void)
     64   1.5  joerg {
     65   1.5  joerg 	register void *__tmp;
     66   1.5  joerg 
     67   1.5  joerg 	__asm volatile("mfctl\t27 /* CR_TLS */, %0" : "=r" (__tmp));
     68   1.5  joerg 
     69   1.5  joerg 	return __tmp;
     70   1.5  joerg }
     71   1.5  joerg 
     72   1.3    chs #endif /* !__ASSEMBLER__ */
     73   1.3    chs 
     74   1.3    chs #define	_UC_SETSTACK	0x00010000
     75   1.3    chs #define	_UC_CLRSTACK	0x00020000
     76   1.7  skrll #define	_UC_TLSBASE	0x00040000
     77   1.1    chs 
     78   1.1    chs #endif /* _HPPA_MCONTEXT_H_ */
     79