xref: /titanic_52/usr/src/uts/sparc/sys/utrap.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * this file contains definitions for user-level traps.
38  */
39 
40 #define	UT_INSTRUCTION_DISABLED			1
41 #define	UT_INSTRUCTION_ERROR			2
42 #define	UT_INSTRUCTION_PROTECTION		3
43 #define	UT_ILLTRAP_INSTRUCTION			4
44 #define	UT_ILLEGAL_INSTRUCTION			5
45 #define	UT_PRIVILEGED_OPCODE			6
46 #define	UT_FP_DISABLED				7
47 #define	UT_FP_EXCEPTION_IEEE_754		8
48 #define	UT_FP_EXCEPTION_OTHER			9
49 #define	UT_TAG_OVERFLOW				10
50 #define	UT_DIVISION_BY_ZERO			11
51 #define	UT_DATA_EXCEPTION			12
52 #define	UT_DATA_ERROR				13
53 #define	UT_DATA_PROTECTION			14
54 #define	UT_MEM_ADDRESS_NOT_ALIGNED		15
55 #define	UT_PRIVILEGED_ACTION			16
56 #define	UT_ASYNC_DATA_ERROR			17
57 #define	UT_TRAP_INSTRUCTION_16			18
58 #define	UT_TRAP_INSTRUCTION_17			19
59 #define	UT_TRAP_INSTRUCTION_18			20
60 #define	UT_TRAP_INSTRUCTION_19			21
61 #define	UT_TRAP_INSTRUCTION_20			22
62 #define	UT_TRAP_INSTRUCTION_21			23
63 #define	UT_TRAP_INSTRUCTION_22			24
64 #define	UT_TRAP_INSTRUCTION_23			25
65 #define	UT_TRAP_INSTRUCTION_24			26
66 #define	UT_TRAP_INSTRUCTION_25			27
67 #define	UT_TRAP_INSTRUCTION_26			28
68 #define	UT_TRAP_INSTRUCTION_27			29
69 #define	UT_TRAP_INSTRUCTION_28			30
70 #define	UT_TRAP_INSTRUCTION_29			31
71 #define	UT_TRAP_INSTRUCTION_30			32
72 #define	UT_TRAP_INSTRUCTION_31			33
73 
74 /*
75  * These defines exist only for the private v8plus install_utrap interface.
76  */
77 #define	UTRAP_V8P_FP_DISABLED			UT_FP_DISABLED
78 #define	UTRAP_V8P_MEM_ADDRESS_NOT_ALIGNED	UT_MEM_ADDRESS_NOT_ALIGNED
79 
80 #ifndef _ASM
81 
82 #define	UTH_NOCHANGE ((utrap_handler_t)(-1))
83 #define	UTRAP_UTH_NOCHANGE	UTH_NOCHANGE
84 
85 typedef int utrap_entry_t;
86 typedef void *utrap_handler_t;	/* user trap handler entry point */
87 
88 #ifdef __sparcv8plus
89 int
90 install_utrap(utrap_entry_t type, utrap_handler_t new_handler,
91 	utrap_handler_t *old_handlerp);
92 #endif /* __sparcv8plus */
93 
94 #ifdef _KERNEL
95 struct proc;
96 void utrap_dup(struct proc *pp, struct proc *cp);
97 void utrap_free(struct proc *p);
98 #endif /* _KERNEL */
99 
100 #ifdef __sparcv9
101 int
102 __sparc_utrap_install(utrap_entry_t type,
103 	utrap_handler_t new_precise, utrap_handler_t new_deferred,
104 	utrap_handler_t *old_precise, utrap_handler_t *old_deferred);
105 #endif
106 
107 /* The trap_instruction user traps are precise only. */
108 #define	UT_PRECISE_MAXTRAPS				33
109 
110 #endif /* ASM */
111 
112 #ifdef	__cplusplus
113 }
114 #endif
115 
116 #endif	/* _UTRAP_H */
117