xref: /freebsd/sys/powerpc/include/ucontext.h (revision fbd21ea62089d8c35f99c8cfd768e1af3c43d129)
160727d8bSWarner Losh /*-
2fb75554eSBenno Rice  * Copyright (C) 1995, 1996 Wolfgang Solfrank.
3fb75554eSBenno Rice  * Copyright (C) 1995, 1996 TooLs GmbH.
4fb75554eSBenno Rice  * All rights reserved.
5fb75554eSBenno Rice  *
6fb75554eSBenno Rice  * Redistribution and use in source and binary forms, with or without
7fb75554eSBenno Rice  * modification, are permitted provided that the following conditions
8fb75554eSBenno Rice  * are met:
9fb75554eSBenno Rice  * 1. Redistributions of source code must retain the above copyright
10fb75554eSBenno Rice  *    notice, this list of conditions and the following disclaimer.
11fb75554eSBenno Rice  * 2. Redistributions in binary form must reproduce the above copyright
12fb75554eSBenno Rice  *    notice, this list of conditions and the following disclaimer in the
13fb75554eSBenno Rice  *    documentation and/or other materials provided with the distribution.
14fb75554eSBenno Rice  * 3. All advertising materials mentioning features or use of this software
15fb75554eSBenno Rice  *    must display the following acknowledgement:
16fb75554eSBenno Rice  *	This product includes software developed by TooLs GmbH.
17fb75554eSBenno Rice  * 4. The name of TooLs GmbH may not be used to endorse or promote products
18fb75554eSBenno Rice  *    derived from this software without specific prior written permission.
19fb75554eSBenno Rice  *
20fb75554eSBenno Rice  * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
21fb75554eSBenno Rice  * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
22fb75554eSBenno Rice  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
23fb75554eSBenno Rice  * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24fb75554eSBenno Rice  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25fb75554eSBenno Rice  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
26fb75554eSBenno Rice  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
27fb75554eSBenno Rice  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
28fb75554eSBenno Rice  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
29fb75554eSBenno Rice  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30dfeade78SDavid E. O'Brien  *
31dfeade78SDavid E. O'Brien  * $NetBSD: signal.h,v 1.4 1998/09/14 02:48:34 thorpej Exp $
32dfeade78SDavid E. O'Brien  * $FreeBSD$
33fb75554eSBenno Rice  */
34dfeade78SDavid E. O'Brien 
35fb75554eSBenno Rice #ifndef	_MACHINE_UCONTEXT_H_
36fb75554eSBenno Rice #define	_MACHINE_UCONTEXT_H_
37fb75554eSBenno Rice 
38fb75554eSBenno Rice typedef struct __mcontext {
39919cb336SPeter Grehan 	int		mc_vers;
40919cb336SPeter Grehan 	int		mc_flags;
41919cb336SPeter Grehan #define _MC_FP_VALID	0x01
42919cb336SPeter Grehan #define _MC_AV_VALID	0x02
43fb75554eSBenno Rice 	int		mc_onstack;	  	/* saved onstack flag */
44919cb336SPeter Grehan 	int		mc_len;			/* sizeof(__mcontext) */
45919cb336SPeter Grehan 	uint64_t	mc_avec[32*2];		/* vector register file */
46919cb336SPeter Grehan 	uint32_t	mc_av[2];
47c3e289e1SNathan Whitehorn 	register_t	mc_frame[42];
48919cb336SPeter Grehan 	uint64_t	mc_fpreg[33];
49919cb336SPeter Grehan } mcontext_t __aligned(16);
50919cb336SPeter Grehan 
51c3e289e1SNathan Whitehorn #if defined(_KERNEL) && defined(__powerpc64__)
52c3e289e1SNathan Whitehorn typedef struct __mcontext32 {
53c3e289e1SNathan Whitehorn 	int		mc_vers;
54c3e289e1SNathan Whitehorn 	int		mc_flags;
55c3e289e1SNathan Whitehorn #define _MC_FP_VALID	0x01
56c3e289e1SNathan Whitehorn #define _MC_AV_VALID	0x02
57c3e289e1SNathan Whitehorn 	int		mc_onstack;	  	/* saved onstack flag */
58c3e289e1SNathan Whitehorn 	int		mc_len;			/* sizeof(__mcontext) */
59c3e289e1SNathan Whitehorn 	uint64_t	mc_avec[32*2];		/* vector register file */
60c3e289e1SNathan Whitehorn 	uint32_t	mc_av[2];
61c3e289e1SNathan Whitehorn 	uint32_t	mc_frame[42];
62c3e289e1SNathan Whitehorn 	uint64_t	mc_fpreg[33];
63c3e289e1SNathan Whitehorn } mcontext32_t __aligned(16);
64c3e289e1SNathan Whitehorn #endif
65c3e289e1SNathan Whitehorn 
66919cb336SPeter Grehan /* GPRs and supervisor-level regs */
67919cb336SPeter Grehan #define mc_gpr		mc_frame
68919cb336SPeter Grehan #define mc_lr		mc_frame[32]
69919cb336SPeter Grehan #define mc_cr		mc_frame[33]
70919cb336SPeter Grehan #define mc_xer		mc_frame[34]
71919cb336SPeter Grehan #define	mc_ctr		mc_frame[35]
72919cb336SPeter Grehan #define mc_srr0		mc_frame[36]
73919cb336SPeter Grehan #define mc_srr1		mc_frame[37]
74*fbd21ea6SNathan Whitehorn #define mc_exc		mc_frame[38]
75*fbd21ea6SNathan Whitehorn #define mc_dar		mc_frame[39]
76*fbd21ea6SNathan Whitehorn #define mc_dsisr	mc_frame[40]
77919cb336SPeter Grehan 
78919cb336SPeter Grehan /* floating-point state */
79919cb336SPeter Grehan #define mc_fpscr	mc_fpreg[32]
80919cb336SPeter Grehan 
81919cb336SPeter Grehan /* altivec state */
82919cb336SPeter Grehan #define mc_vscr		mc_av[0]
83919cb336SPeter Grehan #define mc_vrsave	mc_av[1]
84919cb336SPeter Grehan 
85919cb336SPeter Grehan #define _MC_VERSION	0x1
863327cde2SPeter Grehan #define _MC_VERSION_KSE 0xee	/* partial ucontext for libpthread */
87fb75554eSBenno Rice 
88fb75554eSBenno Rice #endif	/* !_MACHINE_UCONTEXT_H_ */
89