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 (the "License").␊ |
6 | * You may not use this file except in compliance with the License.␊ |
7 | *␊ |
8 | * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE␊ |
9 | * or http://www.opensolaris.org/os/licensing.␊ |
10 | * See the License for the specific language governing permissions␊ |
11 | * and limitations under the License.␊ |
12 | *␊ |
13 | * When distributing Covered Code, include this CDDL HEADER in each␊ |
14 | * file and include the License file at usr/src/OPENSOLARIS.LICENSE.␊ |
15 | * If applicable, add the following below this CDDL HEADER, with the␊ |
16 | * fields enclosed by brackets "[]" replaced with your own identifying␊ |
17 | * information: Portions Copyright [yyyy] [name of copyright owner]␊ |
18 | *␊ |
19 | * CDDL HEADER END␊ |
20 | */␊ |
21 | /*␊ |
22 | * Copyright 2006 Sun Microsystems, Inc. All rights reserved.␊ |
23 | * Use is subject to license terms.␊ |
24 | */␊ |
25 | ␊ |
26 | #ifndef␉_FASTTRAP_ISA_H␊ |
27 | #define␉_FASTTRAP_ISA_H␊ |
28 | ␊ |
29 | /*␊ |
30 | * #pragma ident␉"@(#)fasttrap_isa.h␉1.6␉06/09/19 SMI"␊ |
31 | */␊ |
32 | ␊ |
33 | #include <sys/types.h>␊ |
34 | #include <stdint.h>␊ |
35 | ␊ |
36 | #ifdef␉__cplusplus␊ |
37 | extern "C" {␊ |
38 | #endif␊ |
39 | ␊ |
40 | #define␉FASTTRAP_MAX_INSTR_SIZE␉␉15␊ |
41 | ␊ |
42 | #define␉FASTTRAP_INSTR␉␉␉0xcc␊ |
43 | ␊ |
44 | #define␉FASTTRAP_SUNWDTRACE_SIZE␉64␊ |
45 | ␊ |
46 | typedef␉uint8_t␉␉fasttrap_instr_t;␊ |
47 | ␊ |
48 | typedef struct fasttrap_machtp {␊ |
49 | ␉uint8_t␉␉ftmt_instr[FASTTRAP_MAX_INSTR_SIZE]; /* orig. instr. */␊ |
50 | ␉uint8_t␉␉ftmt_size;␉/* instruction size */␊ |
51 | #if __sol64 || defined(__APPLE__)␊ |
52 | ␉uint8_t␉␉ftmt_ripmode;␉/* %rip-relative handling mode */␊ |
53 | ␉uint8_t␉␉ftmt_modrm;␉/* saved modrm byte */␊ |
54 | #endif␊ |
55 | ␉uint8_t␉␉ftmt_type;␉/* emulation type */␊ |
56 | ␉uint8_t␉␉ftmt_code;␉/* branch condition */␊ |
57 | ␉uint8_t␉␉ftmt_base;␉/* branch base */␊ |
58 | ␉uint8_t␉␉ftmt_index;␉/* branch index */␊ |
59 | ␉uint8_t␉␉ftmt_scale;␉/* branch scale */␊ |
60 | ␉uint8_t␉␉ftmt_segment;␉/* segment for memory accesses */␊ |
61 | ␉user_addr_t␉ftmt_dest;␉/* destination of control flow */␊ |
62 | } fasttrap_machtp_t;␊ |
63 | ␊ |
64 | #define␉ftt_instr␉ftt_mtp.ftmt_instr␊ |
65 | #if __sol64 || defined(__APPLE__)␊ |
66 | #define␉ftt_ripmode␉ftt_mtp.ftmt_ripmode␊ |
67 | #define␉ftt_modrm␉ftt_mtp.ftmt_modrm␊ |
68 | #endif␊ |
69 | #define␉ftt_size␉ftt_mtp.ftmt_size␊ |
70 | #define␉ftt_type␉ftt_mtp.ftmt_type␊ |
71 | #define␉ftt_code␉ftt_mtp.ftmt_code␊ |
72 | #define␉ftt_base␉ftt_mtp.ftmt_base␊ |
73 | #define␉ftt_index␉ftt_mtp.ftmt_index␊ |
74 | #define␉ftt_scale␉ftt_mtp.ftmt_scale␊ |
75 | #define␉ftt_segment␉ftt_mtp.ftmt_segment␊ |
76 | #define␉ftt_dest␉ftt_mtp.ftmt_dest␊ |
77 | ␊ |
78 | #define␉FASTTRAP_T_COMMON␉0x00␉/* common case -- no emulation */␊ |
79 | #define␉FASTTRAP_T_JCC␉␉0x01␉/* near and far conditional jumps */␊ |
80 | #define␉FASTTRAP_T_LOOP␉␉0x02␉/* loop instructions */␊ |
81 | #define␉FASTTRAP_T_JCXZ␉␉0x03␉/* jump if %ecx/%rcx is zero */␊ |
82 | #define␉FASTTRAP_T_JMP␉␉0x04␉/* relative jump */␊ |
83 | #define␉FASTTRAP_T_CALL␉␉0x05␉/* near call (and link) */␊ |
84 | #define␉FASTTRAP_T_RET␉␉0x06␉/* ret */␊ |
85 | #define␉FASTTRAP_T_RET16␉0x07␉/* ret <imm16> */␊ |
86 | ␊ |
87 | /*␊ |
88 | * For performance rather than correctness.␊ |
89 | */␊ |
90 | #define␉FASTTRAP_T_PUSHL_EBP␉0x10␉/* pushl %ebp (for function entry) */␊ |
91 | #define␉FASTTRAP_T_NOP␉␉0x11␉/* nop */␊ |
92 | ␊ |
93 | #define␉FASTTRAP_RIP_1␉␉0x1␊ |
94 | #define␉FASTTRAP_RIP_2␉␉0x2␊ |
95 | #define␉FASTTRAP_RIP_X␉␉0x4␊ |
96 | ␊ |
97 | /*␊ |
98 | * Segment values.␊ |
99 | */␊ |
100 | #define␉FASTTRAP_SEG_NONE␉␉0␊ |
101 | #define␉FASTTRAP_SEG_CS␉␉␉1␊ |
102 | #define␉FASTTRAP_SEG_DS␉␉␉2␊ |
103 | #define␉FASTTRAP_SEG_ES␉␉␉3␊ |
104 | #define␉FASTTRAP_SEG_FS␉␉␉4␊ |
105 | #define␉FASTTRAP_SEG_GS␉␉␉5␊ |
106 | #define␉FASTTRAP_SEG_SS␉␉␉6␊ |
107 | ␊ |
108 | #define␉FASTTRAP_RETURN_AFRAMES␉␉6␉␊ |
109 | #define␉FASTTRAP_ENTRY_AFRAMES␉␉5␊ |
110 | #define␉FASTTRAP_OFFSET_AFRAMES␉␉5␊ |
111 | ␊ |
112 | #ifdef␉__cplusplus␊ |
113 | }␊ |
114 | #endif␊ |
115 | ␊ |
116 | #endif␉/* _FASTTRAP_ISA_H */␊ |
117 | |