1 /*
2 * Copyright (c) 2013-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 #include "ptunit.h"
30
31 #include "pt_ild.h"
32
33 #include <string.h>
34
35
36 /* Check that an instruction is decoded correctly. */
ptunit_ild_decode(uint8_t * raw,uint8_t size,enum pt_exec_mode mode)37 static struct ptunit_result ptunit_ild_decode(uint8_t *raw, uint8_t size,
38 enum pt_exec_mode mode)
39 {
40 struct pt_insn_ext iext;
41 struct pt_insn insn;
42 int errcode;
43
44 memset(&iext, 0, sizeof(iext));
45 memset(&insn, 0, sizeof(insn));
46
47 memcpy(insn.raw, raw, size);
48 insn.size = size;
49 insn.mode = mode;
50
51 errcode = pt_ild_decode(&insn, &iext);
52 ptu_int_eq(errcode, 0);
53
54 ptu_uint_eq(insn.size, size);
55 ptu_int_eq(insn.iclass, ptic_other);
56 ptu_int_eq(iext.iclass, PTI_INST_INVALID);
57
58 return ptu_passed();
59 }
60
61 /* Check that an instruction is decoded and classified correctly. */
ptunit_ild_classify(uint8_t * raw,uint8_t size,enum pt_exec_mode mode,pti_inst_enum_t iclass)62 static struct ptunit_result ptunit_ild_classify(uint8_t *raw, uint8_t size,
63 enum pt_exec_mode mode,
64 pti_inst_enum_t iclass)
65 {
66 struct pt_insn_ext iext;
67 struct pt_insn insn;
68 int errcode;
69
70 memset(&iext, 0, sizeof(iext));
71 memset(&insn, 0, sizeof(insn));
72
73 memcpy(insn.raw, raw, size);
74 insn.size = size;
75 insn.mode = mode;
76
77 errcode = pt_ild_decode(&insn, &iext);
78 ptu_int_eq(errcode, 0);
79
80 ptu_uint_eq(insn.size, size);
81 ptu_int_eq(iext.iclass, iclass);
82
83 return ptu_passed();
84 }
85
86 /* Check that an invalid instruction is detected correctly.
87 *
88 * Note that we intentionally do not detect all invalid instructions. This test
89 * therefore only covers some that we care about.
90 */
ptunit_ild_invalid(uint8_t * raw,uint8_t size,enum pt_exec_mode mode)91 static struct ptunit_result ptunit_ild_invalid(uint8_t *raw, uint8_t size,
92 enum pt_exec_mode mode)
93 {
94 struct pt_insn_ext iext;
95 struct pt_insn insn;
96 int errcode;
97
98 memset(&iext, 0, sizeof(iext));
99 memset(&insn, 0, sizeof(insn));
100
101 memcpy(insn.raw, raw, size);
102 insn.size = size;
103 insn.mode = mode;
104
105 errcode = pt_ild_decode(&insn, &iext);
106 ptu_int_eq(errcode, -pte_bad_insn);
107
108 return ptu_passed();
109 }
110
111
112 /* Macros to automatically update the test location. */
113 #define ptu_decode(insn, size, mode) \
114 ptu_check(ptunit_ild_decode, insn, size, mode)
115
116 #define ptu_classify(insn, size, mode, iclass) \
117 ptu_check(ptunit_ild_classify, insn, size, mode, iclass)
118
119 /* Macros to also automatically supply the instruction size. */
120 #define ptu_decode_s(insn, mode) \
121 ptu_decode(insn, sizeof(insn), mode)
122
123 #define ptu_classify_s(insn, mode, iclass) \
124 ptu_classify(insn, sizeof(insn), mode, iclass)
125
126 #define ptu_invalid_s(insn, mode) \
127 ptu_check(ptunit_ild_invalid, insn, sizeof(insn), mode)
128
129
push(void)130 static struct ptunit_result push(void)
131 {
132 uint8_t insn[] = { 0x68, 0x11, 0x22, 0x33, 0x44 };
133
134 ptu_decode_s(insn, ptem_64bit);
135
136 return ptu_passed();
137 }
138
jmp_rel(void)139 static struct ptunit_result jmp_rel(void)
140 {
141 uint8_t insn[] = { 0xE9, 0x60, 0xF9, 0xFF, 0xFF };
142
143 ptu_classify_s(insn, ptem_64bit, PTI_INST_JMP_E9);
144
145 return ptu_passed();
146 }
147
long_nop(void)148 static struct ptunit_result long_nop(void)
149 {
150 uint8_t insn[] = { 0x66, 0x66, 0x66, 0x66,
151 0x66, 0x66, 0X2E, 0X0F,
152 0X1F, 0x84, 0x00, 0x00,
153 0x00, 0x00, 0x00 };
154
155 ptu_decode_s(insn, ptem_64bit);
156
157 return ptu_passed();
158 }
159
mov_al_64(void)160 static struct ptunit_result mov_al_64(void)
161 {
162 uint8_t insn[] = { 0x48, 0xa0, 0x3f, 0xaa, 0xbb, 0xcc, 0xdd, 0xee,
163 0xff, 0x11 };
164
165 ptu_decode_s(insn, ptem_64bit);
166
167 return ptu_passed();
168 }
169
mov_al_32_em64(void)170 static struct ptunit_result mov_al_32_em64(void)
171 {
172 uint8_t insn[] = { 0x67, 0xa0, 0x3f, 0xaa, 0xbb, 0xcc, 0xdd, 0xee,
173 0xff, 0X11 };
174
175 ptu_decode(insn, 6, ptem_64bit);
176
177 return ptu_passed();
178 }
179
mov_al_32(void)180 static struct ptunit_result mov_al_32(void)
181 {
182 uint8_t insn[] = { 0xa0, 0x3f, 0xaa, 0xbb, 0xcc, 0xdd, 0xee };
183
184 ptu_decode(insn, 5, ptem_32bit);
185
186 return ptu_passed();
187 }
188
mov_al_32_em16(void)189 static struct ptunit_result mov_al_32_em16(void)
190 {
191 uint8_t insn[] = { 0x67, 0xa0, 0x3f, 0xaa, 0xbb, 0xcc, 0xdd, 0xee };
192
193 ptu_decode(insn, 6, ptem_16bit);
194
195 return ptu_passed();
196 }
197
mov_al_16_em32(void)198 static struct ptunit_result mov_al_16_em32(void)
199 {
200 uint8_t insn[] = { 0x67, 0xa0, 0x3f, 0xaa, 0xbb, 0xcc, 0xdd, 0xee };
201
202 ptu_decode(insn, 4, ptem_32bit);
203
204 return ptu_passed();
205 }
206
mov_al_16(void)207 static struct ptunit_result mov_al_16(void)
208 {
209 uint8_t insn[] = { 0xa0, 0x3f, 0xaa, 0xbb, 0xcc, 0xdd, 0xee };
210
211 ptu_decode(insn, 3, ptem_16bit);
212
213 return ptu_passed();
214 }
215
rdtsc(void)216 static struct ptunit_result rdtsc(void)
217 {
218 uint8_t insn[] = { 0x0f, 0x31 };
219
220 ptu_decode_s(insn, ptem_64bit);
221
222 return ptu_passed();
223 }
224
pcmpistri(void)225 static struct ptunit_result pcmpistri(void)
226 {
227 uint8_t insn[] = { 0x66, 0x0f, 0x3a, 0x63, 0x04, 0x16, 0x1a };
228
229 ptu_decode_s(insn, ptem_64bit);
230
231 return ptu_passed();
232 }
233
vmovdqa(void)234 static struct ptunit_result vmovdqa(void)
235 {
236 uint8_t insn[] = { 0xc5, 0xf9, 0x6f, 0x25, 0xa9, 0x55, 0x04, 0x00 };
237
238 ptu_decode_s(insn, ptem_64bit);
239
240 return ptu_passed();
241 }
242
vpandn(void)243 static struct ptunit_result vpandn(void)
244 {
245 uint8_t insn[] = { 0xc4, 0x41, 0x29, 0xdf, 0xd1 };
246
247 ptu_decode_s(insn, ptem_64bit);
248
249 return ptu_passed();
250 }
251
syscall(void)252 static struct ptunit_result syscall(void)
253 {
254 uint8_t insn[] = { 0x0f, 0x05 };
255
256 ptu_classify_s(insn, ptem_64bit, PTI_INST_SYSCALL);
257
258 return ptu_passed();
259 }
260
sysret(void)261 static struct ptunit_result sysret(void)
262 {
263 uint8_t insn[] = { 0x0f, 0x07 };
264
265 ptu_classify_s(insn, ptem_64bit, PTI_INST_SYSRET);
266
267 return ptu_passed();
268 }
269
sysenter(void)270 static struct ptunit_result sysenter(void)
271 {
272 uint8_t insn[] = { 0x0f, 0x34 };
273
274 ptu_classify_s(insn, ptem_64bit, PTI_INST_SYSENTER);
275
276 return ptu_passed();
277 }
278
sysexit(void)279 static struct ptunit_result sysexit(void)
280 {
281 uint8_t insn[] = { 0x0f, 0x35 };
282
283 ptu_classify_s(insn, ptem_64bit, PTI_INST_SYSEXIT);
284
285 return ptu_passed();
286 }
287
int3(void)288 static struct ptunit_result int3(void)
289 {
290 uint8_t insn[] = { 0xcc };
291
292 ptu_classify_s(insn, ptem_64bit, PTI_INST_INT3);
293
294 return ptu_passed();
295 }
296
intn(void)297 static struct ptunit_result intn(void)
298 {
299 uint8_t insn[] = { 0xcd, 0x06 };
300
301 ptu_classify_s(insn, ptem_64bit, PTI_INST_INT);
302
303 return ptu_passed();
304 }
305
iret(void)306 static struct ptunit_result iret(void)
307 {
308 uint8_t insn[] = { 0xcf };
309
310 ptu_classify_s(insn, ptem_64bit, PTI_INST_IRET);
311
312 return ptu_passed();
313 }
314
call_9a_cd(void)315 static struct ptunit_result call_9a_cd(void)
316 {
317 uint8_t insn[] = { 0x9a, 0x00, 0x00, 0x00, 0x00 };
318
319 ptu_classify_s(insn, ptem_16bit, PTI_INST_CALL_9A);
320
321 return ptu_passed();
322 }
323
call_9a_cp(void)324 static struct ptunit_result call_9a_cp(void)
325 {
326 uint8_t insn[] = { 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
327
328 ptu_classify_s(insn, ptem_32bit, PTI_INST_CALL_9A);
329
330 return ptu_passed();
331 }
332
call_ff_3(void)333 static struct ptunit_result call_ff_3(void)
334 {
335 uint8_t insn[] = { 0xff, 0x1c, 0x25, 0x00, 0x00, 0x00, 0x00 };
336
337 ptu_classify_s(insn, ptem_64bit, PTI_INST_CALL_FFr3);
338
339 return ptu_passed();
340 }
341
jmp_ff_5(void)342 static struct ptunit_result jmp_ff_5(void)
343 {
344 uint8_t insn[] = { 0xff, 0x2c, 0x25, 0x00, 0x00, 0x00, 0x00 };
345
346 ptu_classify_s(insn, ptem_64bit, PTI_INST_JMP_FFr5);
347
348 return ptu_passed();
349 }
350
jmp_ea_cd(void)351 static struct ptunit_result jmp_ea_cd(void)
352 {
353 uint8_t insn[] = { 0xea, 0x00, 0x00, 0x00, 0x00 };
354
355 ptu_classify_s(insn, ptem_16bit, PTI_INST_JMP_EA);
356
357 return ptu_passed();
358 }
359
jmp_ea_cp(void)360 static struct ptunit_result jmp_ea_cp(void)
361 {
362 uint8_t insn[] = { 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
363
364 ptu_classify_s(insn, ptem_32bit, PTI_INST_JMP_EA);
365
366 return ptu_passed();
367 }
368
ret_ca(void)369 static struct ptunit_result ret_ca(void)
370 {
371 uint8_t insn[] = { 0xca, 0x00, 0x00 };
372
373 ptu_classify_s(insn, ptem_64bit, PTI_INST_RET_CA);
374
375 return ptu_passed();
376 }
377
vmlaunch(void)378 static struct ptunit_result vmlaunch(void)
379 {
380 uint8_t insn[] = { 0x0f, 0x01, 0xc2 };
381
382 ptu_classify_s(insn, ptem_64bit, PTI_INST_VMLAUNCH);
383
384 return ptu_passed();
385 }
386
vmresume(void)387 static struct ptunit_result vmresume(void)
388 {
389 uint8_t insn[] = { 0x0f, 0x01, 0xc3 };
390
391 ptu_classify_s(insn, ptem_64bit, PTI_INST_VMRESUME);
392
393 return ptu_passed();
394 }
395
vmcall(void)396 static struct ptunit_result vmcall(void)
397 {
398 uint8_t insn[] = { 0x0f, 0x01, 0xc1 };
399
400 ptu_classify_s(insn, ptem_64bit, PTI_INST_VMCALL);
401
402 return ptu_passed();
403 }
404
vmptrld(void)405 static struct ptunit_result vmptrld(void)
406 {
407 uint8_t insn[] = { 0x0f, 0xc7, 0x30 };
408
409 ptu_classify_s(insn, ptem_64bit, PTI_INST_VMPTRLD);
410
411 return ptu_passed();
412 }
413
jrcxz(void)414 static struct ptunit_result jrcxz(void)
415 {
416 uint8_t insn[] = { 0xe3, 0x00 };
417
418 ptu_classify_s(insn, ptem_64bit, PTI_INST_JrCXZ);
419
420 return ptu_passed();
421 }
422
mov_eax_moffs64(void)423 static struct ptunit_result mov_eax_moffs64(void)
424 {
425 uint8_t insn[] = { 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
426 0x00 };
427
428 ptu_decode_s(insn, ptem_64bit);
429
430 return ptu_passed();
431 }
432
mov_eax_moffs64_32(void)433 static struct ptunit_result mov_eax_moffs64_32(void)
434 {
435 uint8_t insn[] = { 0x67, 0xa1, 0x00, 0x00, 0x00, 0x00 };
436
437 ptu_decode_s(insn, ptem_64bit);
438
439 return ptu_passed();
440 }
441
mov_rax_moffs64(void)442 static struct ptunit_result mov_rax_moffs64(void)
443 {
444 uint8_t insn[] = { 0x48, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
445 0x00, 0x00 };
446
447 ptu_decode_s(insn, ptem_64bit);
448
449 return ptu_passed();
450 }
451
mov_rax_moffs64_32(void)452 static struct ptunit_result mov_rax_moffs64_32(void)
453 {
454 uint8_t insn[] = { 0x67, 0x48, 0xa1, 0x00, 0x00, 0x00, 0x00 };
455
456 ptu_decode_s(insn, ptem_64bit);
457
458 return ptu_passed();
459 }
460
mov_ax_moffs64(void)461 static struct ptunit_result mov_ax_moffs64(void)
462 {
463 uint8_t insn[] = { 0x66, 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
464 0x00, 0x00 };
465
466 ptu_decode_s(insn, ptem_64bit);
467
468 return ptu_passed();
469 }
470
mov_ax_moffs64_32(void)471 static struct ptunit_result mov_ax_moffs64_32(void)
472 {
473 uint8_t insn[] = { 0x67, 0x66, 0xa1, 0x00, 0x00, 0x00, 0x00 };
474
475 ptu_decode_s(insn, ptem_64bit);
476
477 return ptu_passed();
478 }
479
mov_eax_moffs32(void)480 static struct ptunit_result mov_eax_moffs32(void)
481 {
482 uint8_t insn[] = { 0xa1, 0x00, 0x00, 0x00, 0x00 };
483
484 ptu_decode_s(insn, ptem_32bit);
485
486 return ptu_passed();
487 }
488
mov_ax_moffs32(void)489 static struct ptunit_result mov_ax_moffs32(void)
490 {
491 uint8_t insn[] = { 0x66, 0xa1, 0x00, 0x00, 0x00, 0x00 };
492
493 ptu_decode_s(insn, ptem_32bit);
494
495 return ptu_passed();
496 }
497
mov_ax_moffs16(void)498 static struct ptunit_result mov_ax_moffs16(void)
499 {
500 uint8_t insn[] = { 0xa1, 0x00, 0x00 };
501
502 ptu_decode_s(insn, ptem_16bit);
503
504 return ptu_passed();
505 }
506
les(void)507 static struct ptunit_result les(void)
508 {
509 uint8_t insn[] = { 0xc4, 0x00 };
510
511 ptu_decode_s(insn, ptem_16bit);
512 ptu_decode_s(insn, ptem_32bit);
513
514 return ptu_passed();
515 }
516
les_disp16(void)517 static struct ptunit_result les_disp16(void)
518 {
519 uint8_t insn[] = { 0xc4, 0x06, 0x00, 0x00 };
520
521 ptu_decode_s(insn, ptem_16bit);
522
523 return ptu_passed();
524 }
525
les_disp32(void)526 static struct ptunit_result les_disp32(void)
527 {
528 uint8_t insn[] = { 0xc4, 0x05, 0x00, 0x00, 0x00, 0x00 };
529
530 ptu_decode_s(insn, ptem_32bit);
531
532 return ptu_passed();
533 }
534
les_ind_disp8(void)535 static struct ptunit_result les_ind_disp8(void)
536 {
537 uint8_t insn[] = { 0xc4, 0x40, 0x00 };
538
539 ptu_decode_s(insn, ptem_16bit);
540 ptu_decode_s(insn, ptem_32bit);
541
542 return ptu_passed();
543 }
544
les_ind_disp16(void)545 static struct ptunit_result les_ind_disp16(void)
546 {
547 uint8_t insn[] = { 0xc4, 0x80, 0x00, 0x00 };
548
549 ptu_decode_s(insn, ptem_16bit);
550
551 return ptu_passed();
552 }
553
les_ind_disp32(void)554 static struct ptunit_result les_ind_disp32(void)
555 {
556 uint8_t insn[] = { 0xc4, 0x80, 0x00, 0x00, 0x00, 0x00 };
557
558 ptu_decode_s(insn, ptem_32bit);
559
560 return ptu_passed();
561 }
562
lds(void)563 static struct ptunit_result lds(void)
564 {
565 uint8_t insn[] = { 0xc5, 0x00 };
566
567 ptu_decode_s(insn, ptem_16bit);
568 ptu_decode_s(insn, ptem_32bit);
569
570 return ptu_passed();
571 }
572
lds_disp16(void)573 static struct ptunit_result lds_disp16(void)
574 {
575 uint8_t insn[] = { 0xc5, 0x06, 0x00, 0x00 };
576
577 ptu_decode_s(insn, ptem_16bit);
578
579 return ptu_passed();
580 }
581
lds_disp32(void)582 static struct ptunit_result lds_disp32(void)
583 {
584 uint8_t insn[] = { 0xc5, 0x05, 0x00, 0x00, 0x00, 0x00 };
585
586 ptu_decode_s(insn, ptem_32bit);
587
588 return ptu_passed();
589 }
590
lds_ind_disp8(void)591 static struct ptunit_result lds_ind_disp8(void)
592 {
593 uint8_t insn[] = { 0xc5, 0x40, 0x00 };
594
595 ptu_decode_s(insn, ptem_16bit);
596 ptu_decode_s(insn, ptem_32bit);
597
598 return ptu_passed();
599 }
600
lds_ind_disp16(void)601 static struct ptunit_result lds_ind_disp16(void)
602 {
603 uint8_t insn[] = { 0xc5, 0x80, 0x00, 0x00 };
604
605 ptu_decode_s(insn, ptem_16bit);
606
607 return ptu_passed();
608 }
609
lds_ind_disp32(void)610 static struct ptunit_result lds_ind_disp32(void)
611 {
612 uint8_t insn[] = { 0xc5, 0x80, 0x00, 0x00, 0x00, 0x00 };
613
614 ptu_decode_s(insn, ptem_32bit);
615
616 return ptu_passed();
617 }
618
vpshufb(void)619 static struct ptunit_result vpshufb(void)
620 {
621 uint8_t insn[] = { 0x62, 0x02, 0x05, 0x00, 0x00, 0x00 };
622
623 ptu_decode_s(insn, ptem_64bit);
624
625 return ptu_passed();
626 }
627
bound(void)628 static struct ptunit_result bound(void)
629 {
630 uint8_t insn[] = { 0x62, 0x02 };
631
632 ptu_decode_s(insn, ptem_32bit);
633 ptu_decode_s(insn, ptem_16bit);
634
635 return ptu_passed();
636 }
637
evex_cutoff(void)638 static struct ptunit_result evex_cutoff(void)
639 {
640 uint8_t insn[] = { 0x62 };
641
642 ptu_invalid_s(insn, ptem_64bit);
643 ptu_invalid_s(insn, ptem_32bit);
644 ptu_invalid_s(insn, ptem_16bit);
645
646 return ptu_passed();
647 }
648
ptwrite_r32(void)649 static struct ptunit_result ptwrite_r32(void)
650 {
651 uint8_t insn[] = { 0xf3, 0x0f, 0xae, 0xe7 };
652
653 ptu_classify_s(insn, ptem_64bit, PTI_INST_PTWRITE);
654 ptu_classify_s(insn, ptem_32bit, PTI_INST_PTWRITE);
655 ptu_classify_s(insn, ptem_16bit, PTI_INST_PTWRITE);
656
657 return ptu_passed();
658 }
659
ptwrite_m32(void)660 static struct ptunit_result ptwrite_m32(void)
661 {
662 uint8_t insn[] = { 0xf3, 0x0f, 0xae, 0x67, 0xcc };
663
664 ptu_classify_s(insn, ptem_64bit, PTI_INST_PTWRITE);
665 ptu_classify_s(insn, ptem_32bit, PTI_INST_PTWRITE);
666 ptu_classify_s(insn, ptem_16bit, PTI_INST_PTWRITE);
667
668 return ptu_passed();
669 }
670
ptwrite_r64(void)671 static struct ptunit_result ptwrite_r64(void)
672 {
673 uint8_t insn[] = { 0xf3, 0x48, 0x0f, 0xae, 0xe7 };
674
675 ptu_classify_s(insn, ptem_64bit, PTI_INST_PTWRITE);
676
677 return ptu_passed();
678 }
679
ptwrite_m64(void)680 static struct ptunit_result ptwrite_m64(void)
681 {
682 uint8_t insn[] = { 0xf3, 0x48, 0x0f, 0xae, 0x67, 0xcc };
683
684 ptu_classify_s(insn, ptem_64bit, PTI_INST_PTWRITE);
685
686 return ptu_passed();
687 }
688
main(int argc,char ** argv)689 int main(int argc, char **argv)
690 {
691 struct ptunit_suite suite;
692
693 suite = ptunit_mk_suite(argc, argv);
694
695 ptu_run(suite, push);
696 ptu_run(suite, jmp_rel);
697 ptu_run(suite, long_nop);
698 ptu_run(suite, mov_al_64);
699 ptu_run(suite, mov_al_32);
700 ptu_run(suite, mov_al_32_em64);
701 ptu_run(suite, mov_al_32_em16);
702 ptu_run(suite, mov_al_16_em32);
703 ptu_run(suite, mov_al_16);
704 ptu_run(suite, rdtsc);
705 ptu_run(suite, pcmpistri);
706 ptu_run(suite, vmovdqa);
707 ptu_run(suite, vpandn);
708 ptu_run(suite, syscall);
709 ptu_run(suite, sysret);
710 ptu_run(suite, sysenter);
711 ptu_run(suite, sysexit);
712 ptu_run(suite, int3);
713 ptu_run(suite, intn);
714 ptu_run(suite, iret);
715 ptu_run(suite, call_9a_cd);
716 ptu_run(suite, call_9a_cp);
717 ptu_run(suite, call_ff_3);
718 ptu_run(suite, jmp_ff_5);
719 ptu_run(suite, jmp_ea_cd);
720 ptu_run(suite, jmp_ea_cp);
721 ptu_run(suite, ret_ca);
722 ptu_run(suite, vmlaunch);
723 ptu_run(suite, vmresume);
724 ptu_run(suite, vmcall);
725 ptu_run(suite, vmptrld);
726 ptu_run(suite, jrcxz);
727 ptu_run(suite, mov_eax_moffs64);
728 ptu_run(suite, mov_eax_moffs64_32);
729 ptu_run(suite, mov_rax_moffs64);
730 ptu_run(suite, mov_rax_moffs64_32);
731 ptu_run(suite, mov_ax_moffs64);
732 ptu_run(suite, mov_ax_moffs64_32);
733 ptu_run(suite, mov_eax_moffs32);
734 ptu_run(suite, mov_ax_moffs32);
735 ptu_run(suite, mov_ax_moffs16);
736 ptu_run(suite, les);
737 ptu_run(suite, les_disp16);
738 ptu_run(suite, les_disp32);
739 ptu_run(suite, les_ind_disp8);
740 ptu_run(suite, les_ind_disp16);
741 ptu_run(suite, les_ind_disp32);
742 ptu_run(suite, lds);
743 ptu_run(suite, lds_disp16);
744 ptu_run(suite, lds_disp32);
745 ptu_run(suite, lds_ind_disp8);
746 ptu_run(suite, lds_ind_disp16);
747 ptu_run(suite, lds_ind_disp32);
748 ptu_run(suite, vpshufb);
749 ptu_run(suite, bound);
750 ptu_run(suite, evex_cutoff);
751 ptu_run(suite, ptwrite_r32);
752 ptu_run(suite, ptwrite_m32);
753 ptu_run(suite, ptwrite_r64);
754 ptu_run(suite, ptwrite_m64);
755
756 return ptunit_report(&suite);
757 }
758