1/*	$OpenBSD: frame.h,v 1.5 2020/07/13 22:37:37 kettenis Exp $	*/
2
3/*
4 * Copyright (C) 1995, 1996 Wolfgang Solfrank.
5 * Copyright (C) 1995, 1996 TooLs GmbH.
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions
10 * are met:
11 * 1. Redistributions of source code must retain the above copyright
12 *    notice, this list of conditions and the following disclaimer.
13 * 2. Redistributions in binary form must reproduce the above copyright
14 *    notice, this list of conditions and the following disclaimer in the
15 *    documentation and/or other materials provided with the distribution.
16 * 3. All advertising materials mentioning features or use of this software
17 *    must display the following acknowledgement:
18 *	This product includes software developed by TooLs GmbH.
19 * 4. The name of TooLs GmbH may not be used to endorse or promote products
20 *    derived from this software without specific prior written permission.
21 *
22 * THIS SOFTWARE IS PROVIDED BY TOOLS GMBH ``AS IS'' AND ANY EXPRESS OR
23 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
24 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
25 * IN NO EVENT SHALL TOOLS GMBH BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
27 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
28 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
29 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
30 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
31 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33
34#ifndef _MACHDEP_FRAME_H
35#define _MACHDEP_FRAME_H
36
37/*
38 * We have to save all registers on every trap, because
39 *	1. user could attach this process every time
40 *	2. we must be able to restore all user registers in case of fork
41 * Actually, we do not save the fp registers on trap, since
42 * these are not used by the kernel. They are saved only when switching
43 * between processes using the FPU.
44 *
45 */
46struct trapframe {
47	__register_t fixreg[32];
48	__register_t lr;
49	__register_t cr;
50	__register_t xer;
51	__register_t ctr;
52	__register_t srr0;
53	__register_t srr1;
54	__register_t vrsave;
55	__register_t dar;	/* dar & dsisr are only filled on a DSI trap */
56	__register_t dsisr;
57	__register_t exc;
58};
59
60/*
61 * This is to ensure alignment of the stackpointer
62 */
63#define	FRAMELEN	roundup(sizeof(struct trapframe) + 32, 16)
64
65struct callframe {
66	register_t	cf_sp;
67	register_t	cf_cr;
68	register_t	cf_lr;
69	register_t	cf_toc;
70};
71
72struct sigframe {
73	int		sf_signum;
74	siginfo_t	*sf_sip;
75	struct sigcontext sf_sc;
76	siginfo_t	sf_si;
77};
78
79struct switchframe {
80	register_t	sf_sp;
81	register_t	sf_cr;
82	register_t	sf_lr;		/* unused */
83	register_t	sf_toc;		/* unused */
84	register_t	sf_r14;
85	register_t	sf_r15;
86	register_t	sf_r16;
87	register_t	sf_r17;
88	register_t	sf_r18;
89	register_t	sf_r19;
90	register_t	sf_r20;
91	register_t	sf_r21;
92	register_t	sf_r22;
93	register_t	sf_r23;
94	register_t	sf_r24;
95	register_t	sf_r25;
96	register_t	sf_r26;
97	register_t	sf_r27;
98	register_t	sf_r28;
99	register_t	sf_r29;
100	register_t	sf_r30;
101	register_t	sf_r31;
102};
103
104#endif /* _MACHDEP_FRAME_H_ */
105