xref: /titanic_41/usr/src/uts/sparc/sys/fasttrap_isa.h (revision 70025d765b044c6d8594bb965a2247a61e991a99)
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 2005 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_FASTTRAP_ISA_H
28 #define	_FASTTRAP_ISA_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #include <sys/types.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 /*
39  * This is our reserved trap instruction: ta 0x38
40  */
41 #define	FASTTRAP_INSTR			0x91d02038
42 
43 #define	FASTTRAP_SUNWDTRACE_SIZE	128
44 
45 typedef uint32_t	fasttrap_instr_t;
46 
47 typedef struct fasttrap_machtp {
48 	fasttrap_instr_t	ftmt_instr;	/* original instruction */
49 	uintptr_t		ftmt_dest;	/* destination of DCTI */
50 	uint8_t			ftmt_type;	/* emulation type */
51 	uint8_t			ftmt_flags;	/* emulation flags */
52 	uint8_t			ftmt_cc;	/* which cc to look at */
53 	uint8_t			ftmt_code;	/* branch condition */
54 } fasttrap_machtp_t;
55 
56 #define	ftt_instr	ftt_mtp.ftmt_instr
57 #define	ftt_dest	ftt_mtp.ftmt_dest
58 #define	ftt_type	ftt_mtp.ftmt_type
59 #define	ftt_flags	ftt_mtp.ftmt_flags
60 #define	ftt_cc		ftt_mtp.ftmt_cc
61 #define	ftt_code	ftt_mtp.ftmt_code
62 
63 #define	FASTTRAP_T_COMMON	0x00	/* common case -- no emulation */
64 #define	FASTTRAP_T_CCR		0x01	/* integer condition code branch */
65 #define	FASTTRAP_T_FCC		0x02	/* floating-point branch */
66 #define	FASTTRAP_T_REG		0x03	/* register predicated branch */
67 #define	FASTTRAP_T_ALWAYS	0x04	/* branch always */
68 #define	FASTTRAP_T_CALL		0x05	/* call instruction */
69 #define	FASTTRAP_T_JMPL		0x06	/* jmpl instruction */
70 #define	FASTTRAP_T_RDPC		0x07	/* rdpc instruction */
71 #define	FASTTRAP_T_RETURN	0x08	/* return instruction */
72 
73 /*
74  * For performance rather than correctness.
75  */
76 #define	FASTTRAP_T_SAVE		0x10	/* save instruction (func entry only) */
77 #define	FASTTRAP_T_RESTORE	0x11	/* restore instruction */
78 #define	FASTTRAP_T_OR		0x12	/* mov instruction */
79 #define	FASTTRAP_T_SETHI	0x13	/* sethi instruction (includes nop) */
80 
81 #define	FASTTRAP_F_ANNUL	0x01	/* branch is annulled */
82 #define	FASTTRAP_F_RETMAYBE	0x02	/* not definitely a return site */
83 
84 #define	FASTTRAP_AFRAMES		3
85 #define	FASTTRAP_RETURN_AFRAMES		4
86 #define	FASTTRAP_ENTRY_AFRAMES		3
87 #define	FASTTRAP_OFFSET_AFRAMES		3
88 
89 
90 #ifdef	__cplusplus
91 }
92 #endif
93 
94 #endif	/* _FASTTRAP_ISA_H */
95