frame.h revision 1.5 1 /* $NetBSD: frame.h,v 1.5 2003/10/07 17:04:19 skd Exp $ */
2
3 /*
4 * Copyright (c) 1994, 1995 Carnegie-Mellon University.
5 * All rights reserved.
6 *
7 * Author: Chris G. Demetriou
8 *
9 * Permission to use, copy, modify and distribute this software and
10 * its documentation is hereby granted, provided that both the copyright
11 * notice and this permission notice appear in all copies of the
12 * software, derivative works or modified versions, and any portions
13 * thereof, and that both notices appear in supporting documentation.
14 *
15 * CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS "AS IS"
16 * CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND
17 * FOR ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
18 *
19 * Carnegie Mellon requests users of this software to return to
20 *
21 * Software Distribution Coordinator or Software.Distribution (at) CS.CMU.EDU
22 * School of Computer Science
23 * Carnegie Mellon University
24 * Pittsburgh PA 15213-3890
25 *
26 * any improvements or extensions that they make and grant Carnegie the
27 * rights to redistribute these changes.
28 */
29
30 #ifndef _ALPHA_FRAME_H_
31 #define _ALPHA_FRAME_H_
32
33 #include <machine/alpha_cpu.h>
34
35 /*
36 * Software trap, exception, and syscall frame.
37 *
38 * Includes "hardware" (PALcode) frame.
39 *
40 * PALcode puts ALPHA_HWFRAME_* fields on stack. We have to add
41 * all of the general-purpose registers except for zero, for sp
42 * (which is automatically saved in the PCB's USP field for entries
43 * from user mode, and which is implicitly saved and restored by the
44 * calling conventions for entries from kernel mode), and (on traps
45 * and exceptions) for a0, a1, and a2 (which are saved by PALcode).
46 */
47
48 /* Quadword offsets of the registers to be saved. */
49 #define FRAME_V0 0
50 #define FRAME_T0 1
51 #define FRAME_T1 2
52 #define FRAME_T2 3
53 #define FRAME_T3 4
54 #define FRAME_T4 5
55 #define FRAME_T5 6
56 #define FRAME_T6 7
57 #define FRAME_T7 8
58 #define FRAME_S0 9
59 #define FRAME_S1 10
60 #define FRAME_S2 11
61 #define FRAME_S3 12
62 #define FRAME_S4 13
63 #define FRAME_S5 14
64 #define FRAME_S6 15
65 #define FRAME_A3 16
66 #define FRAME_A4 17
67 #define FRAME_A5 18
68 #define FRAME_T8 19
69 #define FRAME_T9 20
70 #define FRAME_T10 21
71 #define FRAME_T11 22
72 #define FRAME_RA 23
73 #define FRAME_T12 24
74 #define FRAME_AT 25
75 #define FRAME_SP 26
76
77 #define FRAME_SW_SIZE (FRAME_SP + 1)
78 #define FRAME_HW_OFFSET FRAME_SW_SIZE
79
80 #define FRAME_PS (FRAME_HW_OFFSET + ALPHA_HWFRAME_PS)
81 #define FRAME_PC (FRAME_HW_OFFSET + ALPHA_HWFRAME_PC)
82 #define FRAME_GP (FRAME_HW_OFFSET + ALPHA_HWFRAME_GP)
83 #define FRAME_A0 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A0)
84 #define FRAME_A1 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A1)
85 #define FRAME_A2 (FRAME_HW_OFFSET + ALPHA_HWFRAME_A2)
86
87 #define FRAME_HW_SIZE ALPHA_HWFRAME_SIZE
88 #define FRAME_SIZE (FRAME_HW_OFFSET + FRAME_HW_SIZE)
89
90 struct trapframe {
91 unsigned long tf_regs[FRAME_SIZE]; /* See above */
92 };
93
94 #if defined(COMPAT_16) && defined(_KERNEL)
95 struct sigframe_sigcontext {
96 /* ra address of trampoline */
97 /* a0 signum for handler */
98 /* a1 code for handler */
99 /* a2 struct sigcontext for handler */
100 struct sigcontext sf_sc; /* actual saved context */
101 };
102 #endif
103
104 struct sigframe_siginfo {
105 /* ra address of trampoline */
106 /* a0 signal number arg for handler */
107 /* a1 siginfo_t * arg for handler */
108 /* a2 ucontext_t * arg for handler */
109 siginfo_t sf_si; /* actual saved siginfo */
110 ucontext_t sf_uc; /* actual saved ucontext */
111 };
112
113 #ifdef _KERNEL
114 void *getframe(const struct lwp *, int, int *);
115 void buildcontext(struct lwp *, const void *, const void *, const void *);
116 void sendsig_siginfo(const ksiginfo_t *, const sigset_t *);
117 #ifdef COMPAT_16
118 void sendsig_sigcontext(const ksiginfo_t *, const sigset_t *);
119 #endif
120 #endif
121
122 #endif /* _ALPHA_FRAME_H_ */
123