xref: /illumos-gate/usr/src/uts/sparc/sys/utrap.h (revision ed093b41a93e8563e6e1e5dae0768dda2a7bcc27)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 1995-1999,2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef _UTRAP_H
28 #define	_UTRAP_H
29 
30 #ifdef	__cplusplus
31 extern "C" {
32 #endif
33 
34 /*
35  * this file contains definitions for user-level traps.
36  */
37 
38 #define	UT_INSTRUCTION_DISABLED			1
39 #define	UT_INSTRUCTION_ERROR			2
40 #define	UT_INSTRUCTION_PROTECTION		3
41 #define	UT_ILLTRAP_INSTRUCTION			4
42 #define	UT_ILLEGAL_INSTRUCTION			5
43 #define	UT_PRIVILEGED_OPCODE			6
44 #define	UT_FP_DISABLED				7
45 #define	UT_FP_EXCEPTION_IEEE_754		8
46 #define	UT_FP_EXCEPTION_OTHER			9
47 #define	UT_TAG_OVERFLOW				10
48 #define	UT_DIVISION_BY_ZERO			11
49 #define	UT_DATA_EXCEPTION			12
50 #define	UT_DATA_ERROR				13
51 #define	UT_DATA_PROTECTION			14
52 #define	UT_MEM_ADDRESS_NOT_ALIGNED		15
53 #define	UT_PRIVILEGED_ACTION			16
54 #define	UT_ASYNC_DATA_ERROR			17
55 #define	UT_TRAP_INSTRUCTION_16			18
56 #define	UT_TRAP_INSTRUCTION_17			19
57 #define	UT_TRAP_INSTRUCTION_18			20
58 #define	UT_TRAP_INSTRUCTION_19			21
59 #define	UT_TRAP_INSTRUCTION_20			22
60 #define	UT_TRAP_INSTRUCTION_21			23
61 #define	UT_TRAP_INSTRUCTION_22			24
62 #define	UT_TRAP_INSTRUCTION_23			25
63 #define	UT_TRAP_INSTRUCTION_24			26
64 #define	UT_TRAP_INSTRUCTION_25			27
65 #define	UT_TRAP_INSTRUCTION_26			28
66 #define	UT_TRAP_INSTRUCTION_27			29
67 #define	UT_TRAP_INSTRUCTION_28			30
68 #define	UT_TRAP_INSTRUCTION_29			31
69 #define	UT_TRAP_INSTRUCTION_30			32
70 #define	UT_TRAP_INSTRUCTION_31			33
71 
72 /*
73  * These defines exist only for the private v8plus install_utrap interface.
74  */
75 #define	UTRAP_V8P_FP_DISABLED			UT_FP_DISABLED
76 #define	UTRAP_V8P_MEM_ADDRESS_NOT_ALIGNED	UT_MEM_ADDRESS_NOT_ALIGNED
77 
78 #ifndef _ASM
79 
80 #define	UTH_NOCHANGE ((utrap_handler_t)(-1))
81 #define	UTRAP_UTH_NOCHANGE	UTH_NOCHANGE
82 
83 typedef int utrap_entry_t;
84 typedef void *utrap_handler_t;	/* user trap handler entry point */
85 
86 #ifdef __sparcv8plus
87 int
88 install_utrap(utrap_entry_t type, utrap_handler_t new_handler,
89     utrap_handler_t *old_handlerp);
90 #endif /* __sparcv8plus */
91 
92 #ifdef _KERNEL
93 struct proc;
94 void utrap_dup(struct proc *pp, struct proc *cp);
95 void utrap_free(struct proc *p);
96 #endif /* _KERNEL */
97 
98 #ifdef __sparcv9
99 int
100 __sparc_utrap_install(utrap_entry_t type,
101     utrap_handler_t new_precise, utrap_handler_t new_deferred,
102     utrap_handler_t *old_precise, utrap_handler_t *old_deferred);
103 #endif
104 
105 /* The trap_instruction user traps are precise only. */
106 #define	UT_PRECISE_MAXTRAPS				33
107 
108 #endif /* ASM */
109 
110 #ifdef	__cplusplus
111 }
112 #endif
113 
114 #endif	/* _UTRAP_H */
115