xref: /openbsd/sys/arch/alpha/include/frame.h (revision 2fa72412)
1 /*	$OpenBSD: frame.h,v 1.4 2011/03/23 16:54:34 pirofti Exp $	*/
2 /*	$NetBSD: frame.h,v 1.3 1996/07/11 05:31:32 cgd Exp $	*/
3 
4 /*
5  * Copyright (c) 1994, 1995 Carnegie-Mellon University.
6  * All rights reserved.
7  *
8  * Author: Chris G. Demetriou
9  *
10  * Permission to use, copy, modify and distribute this software and
11  * its documentation is hereby granted, provided that both the copyright
12  * notice and this permission notice appear in all copies of the
13  * software, derivative works or modified versions, and any portions
14  * thereof, and that both notices appear in supporting documentation.
15  *
16  * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
17  * CONDITION.  CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
18  * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
19  *
20  * Carnegie Mellon requests users of this software to return to
21  *
22  *  Software Distribution Coordinator  or  Software.Distribution@CS.CMU.EDU
23  *  School of Computer Science
24  *  Carnegie Mellon University
25  *  Pittsburgh PA 15213-3890
26  *
27  * any improvements or extensions that they make and grant Carnegie the
28  * rights to redistribute these changes.
29  */
30 
31 #ifndef _MACHINE_FRAME_H_
32 #define	_MACHINE_FRAME_H_
33 
34 #include <machine/alpha_cpu.h>
35 
36 /*
37  * Software trap, exception, and syscall frame.
38  *
39  * Includes "hardware" (PALcode) frame.
40  *
41  * PALcode puts ALPHA_HWFRAME_* fields on stack.  We have to add
42  * all of the general-purpose registers except for zero, for sp
43  * (which is automatically saved in the PCB's USP field for entries
44  * from user mode, and which is implicitly saved and restored by the
45  * calling conventions for entries from kernel mode), and (on traps
46  * and exceptions) for a0, a1, and a2 (which are saved by PALcode).
47  */
48 
49 /* Quadword offsets of the registers to be saved. */
50 #define	FRAME_V0	0
51 #define	FRAME_T0	1
52 #define	FRAME_T1	2
53 #define	FRAME_T2	3
54 #define	FRAME_T3	4
55 #define	FRAME_T4	5
56 #define	FRAME_T5	6
57 #define	FRAME_T6	7
58 #define	FRAME_T7	8
59 #define	FRAME_S0	9
60 #define	FRAME_S1	10
61 #define	FRAME_S2	11
62 #define	FRAME_S3	12
63 #define	FRAME_S4	13
64 #define	FRAME_S5	14
65 #define	FRAME_S6	15
66 #define	FRAME_A3	16
67 #define	FRAME_A4	17
68 #define	FRAME_A5	18
69 #define	FRAME_T8	19
70 #define	FRAME_T9	20
71 #define	FRAME_T10	21
72 #define	FRAME_T11	22
73 #define	FRAME_RA	23
74 #define	FRAME_T12	24
75 #define	FRAME_AT	25
76 #define	FRAME_SP	26
77 
78 #define	FRAME_SW_SIZE	(FRAME_SP + 1)
79 #define	FRAME_HW_OFFSET	FRAME_SW_SIZE
80 
81 #define	FRAME_PS	(FRAME_HW_OFFSET + ALPHA_HWFRAME_PS)
82 #define	FRAME_PC	(FRAME_HW_OFFSET + ALPHA_HWFRAME_PC)
83 #define	FRAME_GP	(FRAME_HW_OFFSET + ALPHA_HWFRAME_GP)
84 #define	FRAME_A0	(FRAME_HW_OFFSET + ALPHA_HWFRAME_A0)
85 #define	FRAME_A1	(FRAME_HW_OFFSET + ALPHA_HWFRAME_A1)
86 #define	FRAME_A2	(FRAME_HW_OFFSET + ALPHA_HWFRAME_A2)
87 
88 #define	FRAME_HW_SIZE	ALPHA_HWFRAME_SIZE
89 #define	FRAME_SIZE	(FRAME_HW_OFFSET + FRAME_HW_SIZE)
90 
91 struct trapframe {
92 	unsigned long	tf_regs[FRAME_SIZE];	/* See above */
93 };
94 
95 #endif /* _MACHINE_FRAME_H_ */
96