Add ucontext conversion macros for an "extra" register set.

This commit is contained in:
nathanw 2004-02-11 21:04:10 +00:00
parent d93f7028c1
commit 94fc83a6be
2 changed files with 36 additions and 2 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pthread_md.h,v 1.4 2003/01/18 19:11:07 christos Exp $ */
/* $NetBSD: pthread_md.h,v 1.5 2004/02/11 21:04:10 nathanw Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@ -153,4 +153,19 @@ pthread__sp(void)
(uc)->uc_flags = ((uc)->uc_flags | _UC_FPU) & ~_UC_USER; \
} while (/*CONSTCOND*/0)
#define PTHREAD_UCONTEXT_XREG_FLAG _UC_FXSAVE
#define PTHREAD_UCONTEXT_TO_XREG(xreg, uc) \
(void)memcpy((xreg), \
(uc)->uc_mcontext.__fpregs.__fp_reg_set.__fp_xmm_state.__fp_xmm, \
sizeof(struct xmmregs))
#define PTHREAD_XREG_TO_UCONTEXT(uc, xreg) do { \
(void)memcpy( \
(uc)->uc_mcontext.__fpregs.__fp_reg_set.__fp_xmm_state.__fp_xmm, \
(xreg), \
sizeof(struct xmmregs)); \
(uc)->uc_flags = ((uc)->uc_flags | _UC_FXSAVE) & ~_UC_USER; \
} while (/*CONSTCOND*/0)
#endif /* _LIB_PTHREAD_I386_MD_H */

View File

@ -1,4 +1,4 @@
/* $NetBSD: pthread_md.h,v 1.3 2003/01/20 00:53:55 matt Exp $ */
/* $NetBSD: pthread_md.h,v 1.4 2004/02/11 21:04:10 nathanw Exp $ */
/*
* Copyright (c) 2001 Wasabi Systems, Inc.
@ -103,4 +103,23 @@ pthread__sp(void)
(uc)->uc_flags = ((uc)->uc_flags | _UC_FPU) & ~_UC_USER; \
} while (/*CONSTCOND*/0)
#define PTHREAD_UCONTEXT_XREG_FLAG _UC_POWERPC_VEC
#define PTHREAD_UCONTEXT_TO_XREG(xreg, uc) do { \
memcpy(((struct vreg *)(xreg))->vreg, \
(uc)->uc_mcontext.__vrf.__vrs, \
16 * _NVR); \
((struct vreg *)(xreg))->vscr = (uc)->uc_mcontext.__vrf.__vscr; \
((struct vreg *)(xreg))->vrsave = (uc)->uc_mcontext.__vrf.__vrsave; \
} while (/*CONSTCOND*/0)
#define PTHREAD_XREG_TO_UCONTEXT(uc, xreg) do { \
memcpy((uc)->uc_mcontext.__vrf.__vrs, \
((struct vreg *)(xreg))->vreg, \
16 * _NVR); \
(uc)->uc_mcontext.__vrf.__vscr = ((struct vreg *)(xreg))->vscr; \
(uc)->uc_mcontext.__vrf.__vrsave = ((struct vreg *)(xreg))->vrsave; \
(uc)->uc_flags = ((uc)->uc_flags | _UC_POWERPC_VEC) & ~_UC_USER; \
} while (/*CONSTCOND*/0)
#endif /* _LIB_PTHREAD_POWERPC_MD_H */