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