1/*-
2 * Copyright (c) 2001 Jake Burkholder.
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17 * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24 * SUCH DAMAGE.
25 *
26 * $FreeBSD$
27 */
28
29#ifndef	_MACHINE_UTRAP_H_
30#define	_MACHINE_UTRAP_H_
31
32#define	UT_INSTRUCTION_EXCEPTION	1
33#define	UT_INSTRUCTION_ERROR		2
34#define	UT_INSTRUCTION_PROTECTION	3
35#define	UT_ILLTRAP_INSTRUCTION		4
36#define	UT_ILLEGAL_INSTRUCTION		5
37#define	UT_PRIVILEGED_OPCODE		6
38#define	UT_FP_DISABLED			7
39#define	UT_FP_EXCEPTION_IEEE_754	8
40#define	UT_FP_EXCEPTION_OTHER		9
41#define	UT_TAG_OFERFLOW			10
42#define	UT_DIVISION_BY_ZERO		11
43#define	UT_DATA_EXCEPTION		12
44#define	UT_DATA_ERROR			13
45#define	UT_DATA_PROTECTION		14
46#define	UT_MEM_ADDRESS_NOT_ALIGNED	15
47#define	UT_PRIVILEGED_ACTION		16
48#define	UT_ASYNC_DATA_ERROR		17
49#define	UT_TRAP_INSTRUCTION_16		18
50#define	UT_TRAP_INSTRUCTION_17		19
51#define	UT_TRAP_INSTRUCTION_18		20
52#define	UT_TRAP_INSTRUCTION_19		21
53#define	UT_TRAP_INSTRUCTION_20		22
54#define	UT_TRAP_INSTRUCTION_21		23
55#define	UT_TRAP_INSTRUCTION_22		24
56#define	UT_TRAP_INSTRUCTION_23		25
57#define	UT_TRAP_INSTRUCTION_24		26
58#define	UT_TRAP_INSTRUCTION_25		27
59#define	UT_TRAP_INSTRUCTION_26		28
60#define	UT_TRAP_INSTRUCTION_27		29
61#define	UT_TRAP_INSTRUCTION_28		30
62#define	UT_TRAP_INSTRUCTION_29		31
63#define	UT_TRAP_INSTRUCTION_30		32
64#define	UT_TRAP_INSTRUCTION_31		33
65#define	UT_INSTRUCTION_MISS		34
66#define	UT_DATA_MISS			35
67#define	UT_MAX				36
68
69#define	ST_SUNOS_SYSCALL		0
70#define	ST_BREAKPOINT			1
71#define	ST_DIVISION_BY_ZERO		2
72#define	ST_FLUSH_WINDOWS		3	/* XXX implement! */
73#define	ST_CLEAN_WINDOW			4
74#define	ST_RANGE_CHECK			5
75#define	ST_FIX_ALIGNMENT		6
76#define	ST_INTEGER_OVERFLOW		7
77/* 8 is 32-bit ABI syscall (old solaris syscall?) */
78#define	ST_BSD_SYSCALL			9
79#define	ST_FP_RESTORE			10
80/* 11-15 are available */
81/* 16 is linux 32 bit syscall (but supposed to be reserved, grr) */
82/* 17 is old linux 64 bit syscall (but supposed to be reserved, grr) */
83/* 16-31 are reserved for user applications (utraps) */
84#define	ST_GETCC			32	/* XXX implement! */
85#define	ST_SETCC			33	/* XXX implement! */
86#define	ST_GETPSR			34	/* XXX implement! */
87#define	ST_SETPSR			35	/* XXX implement! */
88/* 36-63 are available */
89#define	ST_SOLARIS_SYSCALL		64
90#define	ST_SYSCALL			65
91#define	ST_SYSCALL32			66
92/* 67 is reserved to OS source licensee */
93/* 68 is return from deferred trap (not supported) */
94/* 69-95 are reserved to SPARC international */
95/* 96-108 are available */
96/* 109 is linux 64 bit syscall */
97/* 110 is linux 64 bit getcontext (?) */
98/* 111 is linux 64 bit setcontext (?) */
99/* 112-255 are available */
100
101#define	UTH_NOCHANGE			(-1)
102
103#ifndef __ASM__
104
105typedef	int utrap_entry_t;
106typedef void *utrap_handler_t;
107
108#endif
109
110#endif
111