1129198Scognet/*-
2129198Scognet * Copyright (c) 2001 Jake Burkholder.
3129198Scognet * All rights reserved.
4129198Scognet *
5129198Scognet * Redistribution and use in source and binary forms, with or without
6129198Scognet * modification, are permitted provided that the following conditions
7129198Scognet * are met:
8129198Scognet * 1. Redistributions of source code must retain the above copyright
9129198Scognet *    notice, this list of conditions and the following disclaimer.
10129198Scognet * 2. Redistributions in binary form must reproduce the above copyright
11129198Scognet *    notice, this list of conditions and the following disclaimer in the
12129198Scognet *    documentation and/or other materials provided with the distribution.
13129198Scognet *
14129198Scognet * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
15129198Scognet * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16129198Scognet * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17129198Scognet * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
18129198Scognet * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19129198Scognet * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20129198Scognet * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21129198Scognet * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22129198Scognet * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23129198Scognet * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24129198Scognet * SUCH DAMAGE.
25129198Scognet *
26129198Scognet * $FreeBSD$
27129198Scognet */
28129198Scognet
29129198Scognet#ifndef	_MACHINE_UTRAP_H_
30129198Scognet#define	_MACHINE_UTRAP_H_
31129198Scognet
32129198Scognet#define	UT_INSTRUCTION_EXCEPTION	1
33129198Scognet#define	UT_INSTRUCTION_ERROR		2
34129198Scognet#define	UT_INSTRUCTION_PROTECTION	3
35129198Scognet#define	UT_ILLTRAP_INSTRUCTION		4
36129198Scognet#define	UT_ILLEGAL_INSTRUCTION		5
37129198Scognet#define	UT_PRIVILEGED_OPCODE		6
38129198Scognet#define	UT_FP_DISABLED			7
39129198Scognet#define	UT_FP_EXCEPTION_IEEE_754	8
40129198Scognet#define	UT_FP_EXCEPTION_OTHER		9
41129198Scognet#define	UT_TAG_OFERFLOW			10
42129198Scognet#define	UT_DIVISION_BY_ZERO		11
43129198Scognet#define	UT_DATA_EXCEPTION		12
44129198Scognet#define	UT_DATA_ERROR			13
45129198Scognet#define	UT_DATA_PROTECTION		14
46129198Scognet#define	UT_MEM_ADDRESS_NOT_ALIGNED	15
47129198Scognet#define	UT_PRIVILEGED_ACTION		16
48129198Scognet#define	UT_ASYNC_DATA_ERROR		17
49129198Scognet#define	UT_TRAP_INSTRUCTION_16		18
50129198Scognet#define	UT_TRAP_INSTRUCTION_17		19
51129198Scognet#define	UT_TRAP_INSTRUCTION_18		20
52129198Scognet#define	UT_TRAP_INSTRUCTION_19		21
53129198Scognet#define	UT_TRAP_INSTRUCTION_20		22
54129198Scognet#define	UT_TRAP_INSTRUCTION_21		23
55129198Scognet#define	UT_TRAP_INSTRUCTION_22		24
56129198Scognet#define	UT_TRAP_INSTRUCTION_23		25
57129198Scognet#define	UT_TRAP_INSTRUCTION_24		26
58129198Scognet#define	UT_TRAP_INSTRUCTION_25		27
59129198Scognet#define	UT_TRAP_INSTRUCTION_26		28
60129198Scognet#define	UT_TRAP_INSTRUCTION_27		29
61129198Scognet#define	UT_TRAP_INSTRUCTION_28		30
62129198Scognet#define	UT_TRAP_INSTRUCTION_29		31
63129198Scognet#define	UT_TRAP_INSTRUCTION_30		32
64129198Scognet#define	UT_TRAP_INSTRUCTION_31		33
65129198Scognet#define	UT_INSTRUCTION_MISS		34
66129198Scognet#define	UT_DATA_MISS			35
67129198Scognet#define	UT_MAX				36
68129198Scognet
69129198Scognet#define	ST_SUNOS_SYSCALL		0
70129198Scognet#define	ST_BREAKPOINT			1
71129198Scognet#define	ST_DIVISION_BY_ZERO		2
72129198Scognet#define	ST_FLUSH_WINDOWS		3	/* XXX implement! */
73129198Scognet#define	ST_CLEAN_WINDOW			4
74129198Scognet#define	ST_RANGE_CHECK			5
75129198Scognet#define	ST_FIX_ALIGNMENT		6
76129198Scognet#define	ST_INTEGER_OVERFLOW		7
77129198Scognet/* 8 is 32-bit ABI syscall (old solaris syscall?) */
78129198Scognet#define	ST_BSD_SYSCALL			9
79129198Scognet#define	ST_FP_RESTORE			10
80129198Scognet/* 11-15 are available */
81129198Scognet/* 16 is linux 32 bit syscall (but supposed to be reserved, grr) */
82129198Scognet/* 17 is old linux 64 bit syscall (but supposed to be reserved, grr) */
83129198Scognet/* 16-31 are reserved for user applications (utraps) */
84129198Scognet#define	ST_GETCC			32	/* XXX implement! */
85129198Scognet#define	ST_SETCC			33	/* XXX implement! */
86129198Scognet#define	ST_GETPSR			34	/* XXX implement! */
87129198Scognet#define	ST_SETPSR			35	/* XXX implement! */
88129198Scognet/* 36-63 are available */
89129198Scognet#define	ST_SOLARIS_SYSCALL		64
90129198Scognet#define	ST_SYSCALL			65
91129198Scognet#define	ST_SYSCALL32			66
92129198Scognet/* 67 is reserved to OS source licensee */
93129198Scognet/* 68 is return from deferred trap (not supported) */
94129198Scognet/* 69-95 are reserved to SPARC international */
95129198Scognet/* 96-108 are available */
96129198Scognet/* 109 is linux 64 bit syscall */
97129198Scognet/* 110 is linux 64 bit getcontext (?) */
98129198Scognet/* 111 is linux 64 bit setcontext (?) */
99129198Scognet/* 112-255 are available */
100129198Scognet
101129198Scognet#define	UTH_NOCHANGE			(-1)
102129198Scognet
103129198Scognet#ifndef __ASM__
104129198Scognet
105129198Scognettypedef	int utrap_entry_t;
106129198Scognettypedef void *utrap_handler_t;
107129198Scognet
108129198Scognet#endif
109129198Scognet
110129198Scognet#endif
111