xref: /openbsd-src/sys/arch/sparc64/include/trap.h (revision 078fb2af99811575cddb0e0d9d3fa364626cd30d)
1*078fb2afSkettenis /*	$OpenBSD: trap.h,v 1.5 2013/04/02 13:24:57 kettenis Exp $	*/
2bd12f793Sart /*	$NetBSD: trap.h,v 1.4 1999/06/07 05:28:04 eeh Exp $ */
3bd12f793Sart 
4bd12f793Sart /*
5bd12f793Sart  * Copyright (c) 1996-1999 Eduardo Horvath
6bd12f793Sart  *
7bd12f793Sart  * Redistribution and use in source and binary forms, with or without
8bd12f793Sart  * modification, are permitted provided that the following conditions
9bd12f793Sart  * are met:
10bd12f793Sart  * 1. Redistributions of source code must retain the above copyright
11bd12f793Sart  *    notice, this list of conditions and the following disclaimer.
12bd12f793Sart  *
13bd12f793Sart  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR  ``AS IS'' AND
14bd12f793Sart  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15bd12f793Sart  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16bd12f793Sart  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR  BE LIABLE
17bd12f793Sart  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18bd12f793Sart  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19bd12f793Sart  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20bd12f793Sart  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21bd12f793Sart  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22bd12f793Sart  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23bd12f793Sart  * SUCH DAMAGE.
24bd12f793Sart  *
25bd12f793Sart  */
26bd12f793Sart 
27bd12f793Sart 
28bd12f793Sart #ifndef	_MACHINE_TRAP_H
29bd12f793Sart #define	_MACHINE_TRAP_H
30bd12f793Sart 
31bd12f793Sart /*	trap		vec	  (pri) description	*/
32bd12f793Sart /*			0x000	   unused */
33bd12f793Sart #define	T_POR		0x001	/* (0) power on reset */
34bd12f793Sart #define T_WDR		0x002	/* (1) watchdog reset */
35bd12f793Sart #define T_XIR		0x003	/* (1) externally initiated reset */
36bd12f793Sart #define T_SIR		0x004	/* (1) software initiated reset */
37bd12f793Sart #define T_RED_EXCEPTION	0x005	/* (1) RED state exception */
38bd12f793Sart /*			0x006	   unused */
39bd12f793Sart /*			0x007	   unused */
40bd12f793Sart #define T_INST_EXCEPT	0x008	/* (5) instruction access exception */
41bd12f793Sart #define T_TEXTFAULT	0x009	/* (2) ? Text fault */
42bd12f793Sart #define T_INST_ERROR	0x00a	/* (3) instruction access error */
43bd12f793Sart /*			0x00b	   unused */
44bd12f793Sart /*	through		0x00f	   unused */
45bd12f793Sart #define T_ILLINST	0x010	/* (7) illegal instruction */
46bd12f793Sart #define T_PRIVINST	0x011	/* (6) privileged opcode */
475650c8b4Sjason #define	T_UNIMP_LDD	0x012	/* (6) unimplemented LDD */
485650c8b4Sjason #define	T_UNIMP_STD	0x013	/* (6) unimplemented STD */
495650c8b4Sjason /*			0x014	   unused */
50bd12f793Sart /*	through		0x01f	   unused */
51bd12f793Sart #define T_FPDISABLED	0x020	/* (8) fpu disabled */
52bd12f793Sart #define T_FP_IEEE_754	0x021	/* (11) ieee 754 exception */
53bd12f793Sart #define T_FP_OTHER	0x022	/* (11) other fp exception */
54bd12f793Sart #define T_TAGOF		0x023	/* (14) tag overflow */
55bd12f793Sart #define T_CLEAN_WINDOW	0x024	/* (10) clean window exception */
565650c8b4Sjason /*			0x025	   unused */
57bd12f793Sart /*	through		0x027	   unused */
58bd12f793Sart #define T_DIV0		0x028	/* (15) division routine was handed 0 */
595650c8b4Sjason #define	T_PROCERR	0x029	/* (4) internal processor error */
60bd12f793Sart /*			0x02a	   unused */
61bd12f793Sart /*	through		0x02f	   unused */
62bd12f793Sart #define	T_DATAFAULT	0x030	/* (12) address fault during data fetch */
635650c8b4Sjason #define	T_DATA_MMU_MISS	0x031	/* (12) data access MMU miss */
645650c8b4Sjason #define T_DATA_ERROR	0x032	/* (12) data access error */
655650c8b4Sjason #define T_DATA_PROT	0x033	/* (12) Data protection ??? */
66bd12f793Sart #define	T_ALIGN		0x034	/* (10) address not properly aligned */
67bd12f793Sart #define	T_LDDF_ALIGN	0x035	/* (10) LDDF address not properly aligned */
68bd12f793Sart #define	T_STDF_ALIGN	0x036	/* (10) STDF address not properly aligned */
69bd12f793Sart #define T_PRIVACT	0x037	/* (11) privileged action */
705650c8b4Sjason #define	T_LDQF_ALIGN	0x038	/* (10) LDQF address not properly aligned */
715650c8b4Sjason #define	T_STQF_ALIGN	0x039	/* (10) STQF address not properly aligned */
725650c8b4Sjason /*			0x03a	   unused */
735650c8b4Sjason /*	through		0x03f	   unused */
745650c8b4Sjason #define T_ASYNC_ERROR	0x040	/* (2) ???? */
75bd12f793Sart #define	T_L1INT		0x041	/* (31) level 1 interrupt */
76bd12f793Sart #define	T_L2INT		0x042	/* (30) level 2 interrupt */
77bd12f793Sart #define	T_L3INT		0x043	/* (29) level 3 interrupt */
78bd12f793Sart #define	T_L4INT		0x044	/* (28) level 4 interrupt */
79bd12f793Sart #define	T_L5INT		0x045	/* (27) level 5 interrupt */
80bd12f793Sart #define	T_L6INT		0x046	/* (26) level 6 interrupt */
81bd12f793Sart #define	T_L7INT		0x047	/* (25) level 7 interrupt */
82bd12f793Sart #define	T_L8INT		0x048	/* (24) level 8 interrupt */
83bd12f793Sart #define	T_L9INT		0x049	/* (23) level 9 interrupt */
84bd12f793Sart #define	T_L10INT	0x04a	/* (22) level 10 interrupt */
85bd12f793Sart #define	T_L11INT	0x04b	/* (21) level 11 interrupt */
86bd12f793Sart #define	T_L12INT	0x04c	/* (20) level 12 interrupt */
87bd12f793Sart #define	T_L13INT	0x04d	/* (19) level 13 interrupt */
88bd12f793Sart #define	T_L14INT	0x04e	/* (18) level 14 interrupt */
89bd12f793Sart #define	T_L15INT	0x04f	/* (17) level 15 interrupt */
90bd12f793Sart /*			0x050	   unused */
915650c8b4Sjason /*	through		0x05f	   unused */
92bd12f793Sart #define T_INTVEC	0x060	/* (16) interrupt vector [Interrupt Global Regs]*/
93bd12f793Sart #define T_PA_WATCHPT	0x061	/* (12) Physical addr data watchpoint */
94bd12f793Sart #define T_VA_WATCHPT	0x062	/* (11) Virtual addr data watchpoint */
95bd12f793Sart #define T_ECCERR	0x063	/* (33) ECC correction error */
96bd12f793Sart #define T_FIMMU_MISS	0x064	/* (2) fast instruction access MMU miss */
97bd12f793Sart /*	through		0x067	   unused */
98bd12f793Sart #define T_FDMMU_MISS	0x068	/* (2) fast data access MMU miss */
99bd12f793Sart /*	through		0x06b	   unused */
1005650c8b4Sjason #define T_FDMMU_PROT	0x06c	/* (2) fast data access protection */
1015650c8b4Sjason /*	through		0x06f	   unused */
102bd12f793Sart /*  0x070...0x07f implementation dependent exceptions */
103bd12f793Sart #define T_SPILL_N_NORM	0x080	/* (9) spill (n=0..7) normal */
1045650c8b4Sjason /*	through		0x09f	   unused */
105bd12f793Sart #define T_SPILL_N_OTHER	0x0a0	/* (9) spill (n=0..7) other */
1065650c8b4Sjason /*	through		0x0bf	   unused */
107bd12f793Sart #define T_FILL_N_NORM	0x0c0	/* (9) fill (n=0..7) normal */
1085650c8b4Sjason /*	through		0x0df	   unused */
109bd12f793Sart #define T_FILL_N_OTHER	0x0e0	/* (9) fill (n=0..7) other */
1105650c8b4Sjason /*	through		0x0ff	   unused */
111bd12f793Sart 
112bd12f793Sart /* beginning of `user' vectors (from trap instructions) - all priority 16 */
113bd12f793Sart #define	T_SUN_SYSCALL	0x100	/* system call */
114bd12f793Sart #define	T_BREAKPOINT	0x101	/* breakpoint `instruction' */
115bd12f793Sart #define	T_UDIV0		0x102	/* division routine was handed 0 */
116bd12f793Sart #define	T_FLUSHWIN	0x103	/* flush windows */
117bd12f793Sart #define	T_CLEANWIN	0x104	/* provide clean windows */
118bd12f793Sart #define	T_RANGECHECK	0x105	/* ? */
119bd12f793Sart #define	T_FIXALIGN	0x106	/* fix up unaligned accesses */
120bd12f793Sart #define	T_INTOF		0x107	/* integer overflow ? */
121bd12f793Sart #define	T_SVR4_SYSCALL	0x108	/* SVR4 system call */
122bd12f793Sart #define	T_BSD_SYSCALL	0x109	/* BSD system call */
123bd12f793Sart #define	T_KGDB_EXEC	0x10a	/* for kernel gdb */
124bd12f793Sart 
125bd12f793Sart /* 0x10b..0x1ff are currently unallocated, except the following */
126bd12f793Sart #define T_SVR4_GETCC		0x120
127bd12f793Sart #define T_SVR4_SETCC		0x121
128bd12f793Sart #define T_SVR4_GETPSR		0x122
129bd12f793Sart #define T_SVR4_SETPSR		0x123
130bd12f793Sart #define T_SVR4_GETHRTIME	0x124
131bd12f793Sart #define T_SVR4_GETHRVTIME	0x125
132bd12f793Sart #define T_SVR4_GETHRESTIME	0x127
133bd12f793Sart #define T_GETCC			0x132
134bd12f793Sart #define T_SETCC			0x133
135bd12f793Sart #define T_SVID_SYSCALL		0x164
136bd12f793Sart #define	T_SPARC_INTL_SYSCALL	0x165
137bd12f793Sart #define	T_OS_VENDOR_SYSCALL	0x166
138bd12f793Sart #define	T_HW_OEM_SYSCALL	0x167
139bd12f793Sart #define T_RTF_DEF_TRAP		0x168
1406a4d3eb6Skettenis #define T_MON_BREAKPOINT	0x17f
141bd12f793Sart 
142bd12f793Sart #ifdef _KERNEL			/* pseudo traps for locore.s */
143bd12f793Sart #define	T_RWRET		-1	/* need first user window for trap return */
144bd12f793Sart #define	T_AST		-2	/* no-op, just needed reschedule or profile */
145bd12f793Sart #endif
146bd12f793Sart 
147bd12f793Sart /* flags to system call (flags in %g1 along with syscall number) */
148bd12f793Sart #define	SYSCALL_G2RFLAG	0x400	/* on success, return to %g2 rather than npc */
149bd12f793Sart 
150bd12f793Sart /*
151bd12f793Sart  * `software trap' macros to keep people happy (sparc v8 manual says not
152bd12f793Sart  * to set the upper bits).
153bd12f793Sart  */
154bd12f793Sart #define	ST_BREAKPOINT	(T_BREAKPOINT & 0x7f)
155bd12f793Sart #define	ST_DIV0		(T_DIV0 & 0x7f)
156bd12f793Sart #define	ST_FLUSHWIN	(T_FLUSHWIN & 0x7f)
157bd12f793Sart #define	ST_SYSCALL	(T_SUN_SYSCALL & 0x7f)
158bd12f793Sart 
159bd12f793Sart #endif /* _MACHINE_TRAP_H_ */
160