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 /* Portions Copyright 2013 Justin Hibbits */
23 /*
24  * Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
25  * Use is subject to license terms.
26  */
27 
28 #ifndef	_FASTTRAP_ISA_H
29 #define	_FASTTRAP_ISA_H
30 
31 #pragma ident	"%Z%%M%	%I%	%E% SMI"
32 
33 #include <sys/types.h>
34 
35 #ifdef	__cplusplus
36 extern "C" {
37 #endif
38 
39 #define	FASTTRAP_SUNWDTRACE_SIZE	64
40 #define FASTTRAP_INSTR			0x0FFFDDDD
41 
42 typedef	uint32_t	fasttrap_instr_t;
43 
44 typedef struct fasttrap_machtp_t {
45 	fasttrap_instr_t	ftmt_instr;	/* original instruction */
46 	uintptr_t		ftmt_dest;	/* branch target */
47 	uint8_t			ftmt_type;	/* emulation type */
48 	uint8_t			ftmt_flags;	/* emulation flags */
49 	uint8_t			ftmt_bo;	/* BO field */
50 	uint8_t			ftmt_bi;	/* BI field (CR bit) */
51 } fasttrap_machtp_t;
52 
53 #define	ftt_instr	ftt_mtp.ftmt_instr
54 #define	ftt_dest	ftt_mtp.ftmt_dest
55 #define	ftt_type	ftt_mtp.ftmt_type
56 #define	ftt_flags	ftt_mtp.ftmt_flags
57 #define	ftt_bo		ftt_mtp.ftmt_bo
58 #define	ftt_bi		ftt_mtp.ftmt_bi
59 
60 #define FASTTRAP_T_COMMON	0x00
61 #define FASTTRAP_T_B		0x01
62 #define FASTTRAP_T_BC		0x02
63 #define FASTTRAP_T_BLR		0x03
64 #define FASTTRAP_T_BCTR		0x04
65 #define FASTTRAP_T_NOP		0x05
66 
67 #define	FASTTRAP_AFRAMES		3
68 #define	FASTTRAP_RETURN_AFRAMES		4
69 #define	FASTTRAP_ENTRY_AFRAMES		3
70 #define	FASTTRAP_OFFSET_AFRAMES		3
71 
72 #ifdef	__cplusplus
73 }
74 #endif
75 
76 #endif	/* _FASTTRAP_ISA_H */
77