frame.h revision 1.1 1 /* $NetBSD: frame.h,v 1.1 2002/06/05 01:04:22 fredette Exp $ */
2
3 /* $OpenBSD: frame.h,v 1.11 1999/11/25 18:28:06 mickey Exp $ */
4
5 /*
6 * Copyright (c) 1999 Michael Shalayeff
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 * 1. Redistributions of source code must retain the above copyright
13 * notice, this list of conditions and the following disclaimer.
14 * 2. Redistributions in binary form must reproduce the above copyright
15 * notice, this list of conditions and the following disclaimer in the
16 * documentation and/or other materials provided with the distribution.
17 * 3. All advertising materials mentioning features or use of this software
18 * must display the following acknowledgement:
19 * This product includes software developed by Michael Shalayeff.
20 * 4. The name of the author may not be used to endorse or promote products
21 * derived from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
24 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
25 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
26 * IN NO EVENT SHALL THE AUTHOR OR HIS RELATIVES BE LIABLE FOR ANY DIRECT,
27 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
28 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
29 * SERVICES; LOSS OF MIND, USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
31 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
32 * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
33 * THE POSSIBILITY OF SUCH DAMAGE.
34 */
35
36
37 #ifndef _HPPA_FRAME_H_
38 #define _HPPA_FRAME_H_
39
40 #include <machine/reg.h>
41
42 /*
43 * Call frame definitions
44 */
45 #define HPPA_FRAME_NARGS (12)
46 #define HPPA_FRAME_MAXARGS (HPPA_FRAME_NARGS * 4)
47 #define HPPA_FRAME_ARG(n) (-(32 + 4*((n) + 1)))
48 #define HPPA_FRAME_CARG(n,sp) ((register_t *)((sp) + HPPA_FRAME_ARG(n)))
49 #define HPPA_FRAME_SIZE (64)
50 #define HPPA_FRAME_PSP (-4)
51 #define HPPA_FRAME_EP (-8)
52 #define HPPA_FRAME_CLUP (-12)
53 #define HPPA_FRAME_SL (-16)
54 #define HPPA_FRAME_CRP (-20)
55 #define HPPA_FRAME_ERP (-24)
56 #define HPPA_FRAME_ESR4 (-28)
57 #define HPPA_FRAME_EDP (-32)
58
59 /*
60 * Macros to decode processor status word.
61 */
62 #define HPPA_PC_PRIV_MASK 3
63 #define HPPA_PC_PRIV_KERN 0
64 #define HPPA_PC_PRIV_USER 3
65 #define USERMODE(pc) ((((register_t)pc) & HPPA_PC_PRIV_MASK) != HPPA_PC_PRIV_KERN)
66 #define KERNMODE(pc) (((register_t)pc) & ~HPPA_PC_PRIV_MASK)
67
68 #ifndef _LOCORE
69 /*
70 * the trapframe is divided into two parts:
71 * one is saved while we are in the physical mode (beginning of the trap),
72 * and should be kept as small as possible, since all the interrupts will
73 * be lost during this phase, also it must be 64-bytes aligned, per
74 * pa-risc stack conventions, and it's dependancies in the code (;
75 * the other part is filled out when we are already in the virtual mode,
76 * are able to catch interrupts (they are kept pending) and perform
77 * other trap activities (like tlb misses).
78 */
79 struct trapframe {
80 /* the `physical' part of the trapframe */
81 u_int tf_t1; /* r22 */
82 u_int tf_t2; /* r21 */
83 u_int tf_sp; /* r30 */
84 u_int tf_t3; /* r20 */
85 u_int tf_iisq_head; /* cr17 */
86 u_int tf_iisq_tail;
87 u_int tf_iioq_head; /* cr18 */
88 u_int tf_iioq_tail;
89 u_int tf_eiem; /* cr15 */
90 u_int tf_ipsw; /* cr22 */
91 u_int tf_sr3;
92 u_int tf_pidr1; /* cr8 */
93 u_int tf_isr; /* cr20 */
94 u_int tf_ior; /* cr21 */
95 u_int tf_iir; /* cr19 */
96 u_int tf_flags;
97
98 /* here starts the `virtual' part */
99 u_int tf_sar; /* cr11 */
100 u_int tf_r1;
101 u_int tf_rp; /* r2 */
102 u_int tf_r3; /* frame pointer when -g */
103 u_int tf_r4;
104 u_int tf_r5;
105 u_int tf_r6;
106 u_int tf_r7;
107 u_int tf_r8;
108 u_int tf_r9;
109 u_int tf_r10;
110 u_int tf_r11;
111 u_int tf_r12;
112 u_int tf_r13;
113 u_int tf_r14;
114 u_int tf_r15;
115 u_int tf_r16;
116 u_int tf_r17;
117 u_int tf_r18;
118 u_int tf_t4; /* r19 */
119 u_int tf_arg3; /* r23 */
120 u_int tf_arg2; /* r24 */
121 u_int tf_arg1; /* r25 */
122 u_int tf_arg0; /* r26 */
123 u_int tf_dp; /* r27 */
124 u_int tf_ret0; /* r28 */
125 u_int tf_ret1; /* r29 */
126 u_int tf_r31;
127 u_int tf_sr0;
128 u_int tf_sr1;
129 u_int tf_sr2;
130 u_int tf_sr4;
131 u_int tf_sr5;
132 u_int tf_sr6;
133 u_int tf_sr7;
134 u_int tf_pidr2; /* cr9 */
135 u_int tf_pidr3; /* cr12 */
136 u_int tf_pidr4; /* cr13 */
137 u_int tf_rctr; /* cr0 */
138 u_int tf_ccr; /* cr10 */
139 u_int tf_eirr; /* cr23 - DDB */
140 u_int tf_hptm; /* cr24 - DDB */
141 u_int tf_vtop; /* cr25 - DDB */
142 u_int tf_cr28; /* - DDB */
143 u_int tf_cr30; /* uaddr */
144
145 u_int tf_pad[3]; /* pad to 256 bytes */
146 };
147 #endif /* !_LOCORE */
148
149 #endif /* !_HPPA_FRAME_H_ */
150