xref: /freebsd/contrib/processor-trace/libipt/internal/include/pti-sib.h (revision 6be3386466ab79a84b48429ae66244f21526d3df)
1 /*
2  * Copyright (c) 2017-2019, Intel Corporation
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *
7  *  * Redistributions of source code must retain the above copyright notice,
8  *    this list of conditions and the following disclaimer.
9  *  * Redistributions in binary form must reproduce the above copyright notice,
10  *    this list of conditions and the following disclaimer in the documentation
11  *    and/or other materials provided with the distribution.
12  *  * Neither the name of Intel Corporation nor the names of its contributors
13  *    may be used to endorse or promote products derived from this software
14  *    without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
17  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
18  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
20  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26  * POSSIBILITY OF SUCH DAMAGE.
27  */
28 
29 #ifndef PTI_SIB_H
30 #define PTI_SIB_H
31 
32 #include <stdint.h>
33 
34 
35 static const uint8_t has_sib[4][4][8] = {
36 	/* Effective Addressing Mode: ptem_unknown. */ {
37 		/* MOD: 0 */ {
38 			/* RM: 0 */	0,
39 			/* RM: 1 */	0,
40 			/* RM: 2 */	0,
41 			/* RM: 3 */	0,
42 			/* RM: 4 */	0,
43 			/* RM: 5 */	0,
44 			/* RM: 6 */	0,
45 			/* RM: 7 */	0
46 		},
47 		/* MOD: 1 */ {
48 			/* RM: 0 */	0,
49 			/* RM: 1 */	0,
50 			/* RM: 2 */	0,
51 			/* RM: 3 */	0,
52 			/* RM: 4 */	0,
53 			/* RM: 5 */	0,
54 			/* RM: 6 */	0,
55 			/* RM: 7 */	0
56 		},
57 		/* MOD: 2 */ {
58 			/* RM: 0 */	0,
59 			/* RM: 1 */	0,
60 			/* RM: 2 */	0,
61 			/* RM: 3 */	0,
62 			/* RM: 4 */	0,
63 			/* RM: 5 */	0,
64 			/* RM: 6 */	0,
65 			/* RM: 7 */	0
66 		},
67 		/* MOD: 3 */ {
68 			/* RM: 0 */	0,
69 			/* RM: 1 */	0,
70 			/* RM: 2 */	0,
71 			/* RM: 3 */	0,
72 			/* RM: 4 */	0,
73 			/* RM: 5 */	0,
74 			/* RM: 6 */	0,
75 			/* RM: 7 */	0
76 		}
77 	},
78 
79 	/* Effective Addressing Mode: ptem_16bit. */ {
80 		/* MOD: 0 */ {
81 			/* RM: 0 */	0,
82 			/* RM: 1 */	0,
83 			/* RM: 2 */	0,
84 			/* RM: 3 */	0,
85 			/* RM: 4 */	0,
86 			/* RM: 5 */	0,
87 			/* RM: 6 */	0,
88 			/* RM: 7 */	0
89 		},
90 		/* MOD: 1 */ {
91 			/* RM: 0 */	0,
92 			/* RM: 1 */	0,
93 			/* RM: 2 */	0,
94 			/* RM: 3 */	0,
95 			/* RM: 4 */	0,
96 			/* RM: 5 */	0,
97 			/* RM: 6 */	0,
98 			/* RM: 7 */	0
99 		},
100 		/* MOD: 2 */ {
101 			/* RM: 0 */	0,
102 			/* RM: 1 */	0,
103 			/* RM: 2 */	0,
104 			/* RM: 3 */	0,
105 			/* RM: 4 */	0,
106 			/* RM: 5 */	0,
107 			/* RM: 6 */	0,
108 			/* RM: 7 */	0
109 		},
110 		/* MOD: 3 */ {
111 			/* RM: 0 */	0,
112 			/* RM: 1 */	0,
113 			/* RM: 2 */	0,
114 			/* RM: 3 */	0,
115 			/* RM: 4 */	0,
116 			/* RM: 5 */	0,
117 			/* RM: 6 */	0,
118 			/* RM: 7 */	0
119 		}
120 	},
121 
122 	/* Effective Addressing Mode: ptem_32bit. */ {
123 		/* MOD: 0 */ {
124 			/* RM: 0 */	0,
125 			/* RM: 1 */	0,
126 			/* RM: 2 */	0,
127 			/* RM: 3 */	0,
128 			/* RM: 4 */	1,
129 			/* RM: 5 */	0,
130 			/* RM: 6 */	0,
131 			/* RM: 7 */	0
132 		},
133 		/* MOD: 1 */ {
134 			/* RM: 0 */	0,
135 			/* RM: 1 */	0,
136 			/* RM: 2 */	0,
137 			/* RM: 3 */	0,
138 			/* RM: 4 */	1,
139 			/* RM: 5 */	0,
140 			/* RM: 6 */	0,
141 			/* RM: 7 */	0
142 		},
143 		/* MOD: 2 */ {
144 			/* RM: 0 */	0,
145 			/* RM: 1 */	0,
146 			/* RM: 2 */	0,
147 			/* RM: 3 */	0,
148 			/* RM: 4 */	1,
149 			/* RM: 5 */	0,
150 			/* RM: 6 */	0,
151 			/* RM: 7 */	0
152 		},
153 		/* MOD: 3 */ {
154 			/* RM: 0 */	0,
155 			/* RM: 1 */	0,
156 			/* RM: 2 */	0,
157 			/* RM: 3 */	0,
158 			/* RM: 4 */	0,
159 			/* RM: 5 */	0,
160 			/* RM: 6 */	0,
161 			/* RM: 7 */	0
162 		}
163 	},
164 
165 	/* Effective Addressing Mode: ptem_64bit. */ {
166 		/* MOD: 0 */ {
167 			/* RM: 0 */	0,
168 			/* RM: 1 */	0,
169 			/* RM: 2 */	0,
170 			/* RM: 3 */	0,
171 			/* RM: 4 */	1,
172 			/* RM: 5 */	0,
173 			/* RM: 6 */	0,
174 			/* RM: 7 */	0
175 		},
176 		/* MOD: 1 */ {
177 			/* RM: 0 */	0,
178 			/* RM: 1 */	0,
179 			/* RM: 2 */	0,
180 			/* RM: 3 */	0,
181 			/* RM: 4 */	1,
182 			/* RM: 5 */	0,
183 			/* RM: 6 */	0,
184 			/* RM: 7 */	0
185 		},
186 		/* MOD: 2 */ {
187 			/* RM: 0 */	0,
188 			/* RM: 1 */	0,
189 			/* RM: 2 */	0,
190 			/* RM: 3 */	0,
191 			/* RM: 4 */	1,
192 			/* RM: 5 */	0,
193 			/* RM: 6 */	0,
194 			/* RM: 7 */	0
195 		},
196 		/* MOD: 3 */ {
197 			/* RM: 0 */	0,
198 			/* RM: 1 */	0,
199 			/* RM: 2 */	0,
200 			/* RM: 3 */	0,
201 			/* RM: 4 */	0,
202 			/* RM: 5 */	0,
203 			/* RM: 6 */	0,
204 			/* RM: 7 */	0
205 		}
206 	}
207 };
208 
209 #endif /* PTI_SIB_H */
210