trap.h revision 1.2 1 /* $NetBSD: trap.h,v 1.2 2007/12/22 14:11:10 skrll Exp $ */
2
3 /* $OpenBSD: trap.h,v 1.8 2000/02/10 20:05:39 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 #ifndef _HPPA_TRAP_H_
37 #define _HPPA_TRAP_H_
38
39 /*
40 * This is PA-RISC trap types per 1.1 specs, see .c files for references.
41 */
42 #define T_NONEXIST 0 /* invalid interrupt vector */
43 #define T_HPMC 1 /* high priority machine check */
44 #define T_POWERFAIL 2 /* power failure */
45 #define T_RECOVERY 3 /* recovery counter */
46 #define T_INTERRUPT 4 /* external interrupt */
47 #define T_LPMC 5 /* low-priority machine check */
48 #define T_ITLBMISS 6 /* instruction TLB miss fault */
49 #define T_IPROT 7 /* instruction protection */
50 #define T_ILLEGAL 8 /* Illegal instruction */
51 #define T_IBREAK 9 /* break instruction */
52 #define T_PRIV_OP 10 /* privileged operation */
53 #define T_PRIV_REG 11 /* privileged register */
54 #define T_OVERFLOW 12 /* overflow */
55 #define T_CONDITION 13 /* conditional */
56 #define T_EXCEPTION 14 /* assist exception */
57 #define T_DTLBMISS 15 /* data TLB miss */
58 #define T_ITLBMISSNA 16 /* ITLB non-access miss */
59 #define T_DTLBMISSNA 17 /* DTLB non-access miss */
60 #define T_DPROT 18 /* data protection/rights/alignment <7100 */
61 #define T_DBREAK 19 /* data break */
62 #define T_TLB_DIRTY 20 /* TLB dirty bit */
63 #define T_PAGEREF 21 /* page reference */
64 #define T_EMULATION 22 /* assist emulation */
65 #define T_HIGHERPL 23 /* higher-privelege transfer */
66 #define T_LOWERPL 24 /* lower-privilege transfer */
67 #define T_TAKENBR 25 /* taken branch */
68 #define T_DATACC 26 /* data access rights >=7100 */
69 #define T_DATAPID 27 /* data protection ID >=7100 */
70 #define T_DATALIGN 28 /* unaligned data ref */
71 #define T_PERFMON 29 /* performance monitor interrupt */
72 #define T_IDEBUG 30 /* debug SFU interrupt */
73 #define T_DDEBUG 31 /* debug SFU interrupt */
74
75 /*
76 * Reserved range for traps is 0-63, place user flag at 6th bit
77 */
78 #define T_USER_POS 25
79 #define T_USER (1 << (31 - T_USER_POS))
80
81 /*
82 * Various trap frame flags.
83 */
84 #define TFF_LAST_POS 0
85 #define TFF_ITLB_POS 1
86 #define TFF_SYS_POS 2
87 #define TFF_INTR_POS 3
88
89 #define TFF_LAST (1 << (31 - TFF_LAST_POS))
90 #define TFF_ITLB (1 << (31 - TFF_ITLB_POS))
91 #define TFF_SYS (1 << (31 - TFF_SYS_POS))
92 #define TFF_INTR (1 << (31 - TFF_INTR_POS))
93
94 /*
95 * Define this for pretty printings of trapflags.
96 */
97 #define T_BITS "\020\07user\036intr\037itlb\040last"
98
99 /*
100 * These are break instruction entry points.
101 */
102 /* im5 */
103 #define HPPA_BREAK_KERNEL 0
104 /* im13 */
105 #define HPPA_BREAK_SS 4
106 #define HPPA_BREAK_KGDB 5
107 #define HPPA_BREAK_GET_PSW 9
108 #define HPPA_BREAK_SET_PSW 10
109
110 /*
111 * break instruction decoding.
112 */
113 #define break5(i) ((i) & 0x1f)
114 #define break13(i) (((i) >> 13) & 0x1fff)
115
116 #endif /* _HPPA_TRAP_H_ */
117
118