1139825Simp/*-
268549Sbenno * Copyright (C) 1995, 1996 Wolfgang Solfrank.
368549Sbenno * Copyright (C) 1995, 1996 TooLs GmbH.
468549Sbenno * All rights reserved.
568549Sbenno *
668549Sbenno * Redistribution and use in source and binary forms, with or without
768549Sbenno * modification, are permitted provided that the following conditions
868549Sbenno * are met:
968549Sbenno * 1. Redistributions of source code must retain the above copyright
1068549Sbenno *    notice, this list of conditions and the following disclaimer.
1168549Sbenno * 2. Redistributions in binary form must reproduce the above copyright
1268549Sbenno *    notice, this list of conditions and the following disclaimer in the
1368549Sbenno *    documentation and/or other materials provided with the distribution.
1468549Sbenno * 3. All advertising materials mentioning features or use of this software
1568549Sbenno *    must display the following acknowledgement:
1668549Sbenno *	This product includes software developed by TooLs GmbH.
1768549Sbenno * 4. The name of TooLs GmbH may not be used to endorse or promote products
1868549Sbenno *    derived from this software without specific prior written permission.
1968549Sbenno *
2068549Sbenno * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
2168549Sbenno * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
2268549Sbenno * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
2368549Sbenno * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
2468549Sbenno * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
2568549Sbenno * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
2668549Sbenno * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
2768549Sbenno * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
2868549Sbenno * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
2968549Sbenno * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
3070585Sobrien *
3170585Sobrien * $NetBSD: signal.h,v 1.4 1998/09/14 02:48:34 thorpej Exp $
3270585Sobrien * $FreeBSD$
3368549Sbenno */
3470585Sobrien
3568549Sbenno#ifndef	_MACHINE_UCONTEXT_H_
3668549Sbenno#define	_MACHINE_UCONTEXT_H_
3768549Sbenno
38126474Sgrehantypedef struct __mcontext {
39126474Sgrehan	int		mc_vers;
40126474Sgrehan	int		mc_flags;
41126474Sgrehan#define _MC_FP_VALID	0x01
42126474Sgrehan#define _MC_AV_VALID	0x02
43126474Sgrehan	int		mc_onstack;	  	/* saved onstack flag */
44126474Sgrehan	int		mc_len;			/* sizeof(__mcontext) */
45126474Sgrehan	uint64_t	mc_avec[32*2];		/* vector register file */
46126474Sgrehan	uint32_t	mc_av[2];
47209975Snwhitehorn	register_t	mc_frame[42];
48126474Sgrehan	uint64_t	mc_fpreg[33];
49126474Sgrehan} mcontext_t __aligned(16);
5068549Sbenno
51209975Snwhitehorn#if defined(_KERNEL) && defined(__powerpc64__)
52209975Snwhitehorntypedef struct __mcontext32 {
53209975Snwhitehorn	int		mc_vers;
54209975Snwhitehorn	int		mc_flags;
55209975Snwhitehorn#define _MC_FP_VALID	0x01
56209975Snwhitehorn#define _MC_AV_VALID	0x02
57209975Snwhitehorn	int		mc_onstack;	  	/* saved onstack flag */
58209975Snwhitehorn	int		mc_len;			/* sizeof(__mcontext) */
59209975Snwhitehorn	uint64_t	mc_avec[32*2];		/* vector register file */
60209975Snwhitehorn	uint32_t	mc_av[2];
61209975Snwhitehorn	uint32_t	mc_frame[42];
62209975Snwhitehorn	uint64_t	mc_fpreg[33];
63209975Snwhitehorn} mcontext32_t __aligned(16);
64209975Snwhitehorn#endif
65209975Snwhitehorn
66126474Sgrehan/* GPRs and supervisor-level regs */
67126474Sgrehan#define mc_gpr		mc_frame
68126474Sgrehan#define mc_lr		mc_frame[32]
69126474Sgrehan#define mc_cr		mc_frame[33]
70126474Sgrehan#define mc_xer		mc_frame[34]
71126474Sgrehan#define	mc_ctr		mc_frame[35]
72126474Sgrehan#define mc_srr0		mc_frame[36]
73126474Sgrehan#define mc_srr1		mc_frame[37]
74234706Snwhitehorn#define mc_exc		mc_frame[38]
75234706Snwhitehorn#define mc_dar		mc_frame[39]
76234706Snwhitehorn#define mc_dsisr	mc_frame[40]
7768549Sbenno
78126474Sgrehan/* floating-point state */
79126474Sgrehan#define mc_fpscr	mc_fpreg[32]
8068549Sbenno
81126474Sgrehan/* altivec state */
82126474Sgrehan#define mc_vscr		mc_av[0]
83126474Sgrehan#define mc_vrsave	mc_av[1]
84126474Sgrehan
85126474Sgrehan#define _MC_VERSION	0x1
86132380Sgrehan#define _MC_VERSION_KSE 0xee	/* partial ucontext for libpthread */
87126474Sgrehan
8868549Sbenno#endif	/* !_MACHINE_UCONTEXT_H_ */
89