Lines Matching +full:0 +full:x80

7 #define ARRAY_SIZE(_a) (sizeof(_a)/sizeof((_a)[0]))
17 #define NULL ((void*)0)
25 "mov $0x1234, %eax \n\t"
33 for (n = 0; *str; ++str) in strlen()
40 asm volatile("out %0, %1" : : "a"(data), "d"(port)); in outb()
44 static int serial_iobase = 0x3f8;
45 static int serial_inited = 0;
50 asm volatile("in %1, %0" : "=a"(data) : "d"(port)); in inb()
59 lsr = inb(serial_iobase + 0x05); in serial_outb()
60 } while (!(lsr & 0x20)); in serial_outb()
62 outb(ch, serial_iobase + 0x00); in serial_outb()
70 lcr = inb(serial_iobase + 0x03); in serial_init()
71 lcr |= 0x80; in serial_init()
72 outb(lcr, serial_iobase + 0x03); in serial_init()
75 outb(0x01, serial_iobase + 0x00); in serial_init()
76 outb(0x00, serial_iobase + 0x01); in serial_init()
79 lcr = inb(serial_iobase + 0x03); in serial_init()
80 lcr &= ~0x80; in serial_init()
81 outb(lcr, serial_iobase + 0x03); in serial_init()
84 outb(0x00, serial_iobase + 0x01); in serial_init()
86 outb(0x03, serial_iobase + 0x03); in serial_init()
88 outb(0x00, serial_iobase + 0x02); in serial_init()
90 outb(0x03, serial_iobase + 0x04); in serial_init()
104 for (i = 0; i < len; i++) { in print_serial()
108 asm volatile ("addr32/rep/outsb" : "+S"(buf), "+c"(len) : "d"(0xf1)); in print_serial()
116 *p = 0; in print_serial_u32()
118 *--p = '0' + (value % 10); in print_serial_u32()
120 } while (value > 0); in print_serial_u32()
128 outb(code, 0xf4); in exit()
130 if (code == 0) in exit()
131 print_serial("--- DONE: 0 ---\n"); in exit()
152 0,
153 0x00cf9b000000ffffull, // flat 32-bit code segment
154 0x00cf93000000ffffull, // flat 32-bit data segment
176 inregs = (struct regs){ 0 }; in init_inregs()
190 for (i = 0; i < insn->len; ++i) in exec_in_big_real_mode()
193 test_insn[i] = 0x90; // nop in exec_in_big_real_mode()
209 "xchg %%eax, %[save]+0 \n\t" in exec_in_big_real_mode()
221 "xchg %%eax, %[save]+0 \n\t" in exec_in_big_real_mode()
262 for (i = 0; i < 8; ++i) in regs_equal()
264 return 0; in regs_equal()
271 ok = 0; in report()
305 …inregs = (struct regs){ .eax = 0, .ebx = 1, .ecx = 2, .edx = 3, .esi = 4, .edi = 5, .ebp = 6, .esp… in test_xchg()
308 report("xchg 1", 0, 1); in test_xchg()
343 init_inregs(&(struct regs){ .eax = 0xbe, .edx = 0xef000000 }); in test_shld()
346 report("shld", ~0, outregs.eax == 0xbeef); in test_shld()
353 MK_INSN(mov_r8_imm_1, "mov $0x12, %ah"); in test_mov_imm()
354 MK_INSN(mov_r8_imm_2, "mov $0x34, %al"); in test_mov_imm()
355 MK_INSN(mov_r8_imm_3, "mov $0x12, %ah\n\t" "mov $0x34, %al\n\t"); in test_mov_imm()
368 report("mov 3", R_AX, outregs.eax == 0x1200); in test_mov_imm()
371 report("mov 4", R_AX, outregs.eax == 0x34); in test_mov_imm()
374 report("mov 5", R_AX, outregs.eax == 0x1234); in test_mov_imm()
381 MK_INSN(sub_r8_imm_1, "mov $0x12, %ah\n\t" "sub $0x10, %ah\n\t"); in test_sub_imm()
382 MK_INSN(sub_r8_imm_2, "mov $0x34, %al\n\t" "sub $0x10, %al\n\t"); in test_sub_imm()
395 report("sub 3", R_AX, outregs.eax == 0x0200); in test_sub_imm()
398 report("sub 4", R_AX, outregs.eax == 0x24); in test_sub_imm()
405 MK_INSN(xor_r8_imm_1, "mov $0x12, %ah\n\t" "xor $0x12, %ah\n\t"); in test_xor_imm()
406 MK_INSN(xor_r8_imm_2, "mov $0x34, %al\n\t" "xor $0x34, %al\n\t"); in test_xor_imm()
411 report("xor 1", R_AX, outregs.eax == 0); in test_xor_imm()
415 report("xor 2", R_AX, outregs.eax == 0); in test_xor_imm()
419 report("xor 3", R_AX, outregs.eax == 0); in test_xor_imm()
422 report("xor 4", R_AX, outregs.eax == 0); in test_xor_imm()
427 MK_INSN(cmp_test1, "mov $0x34, %al\n\t" in test_cmp_imm()
428 "cmp $0x34, %al\n\t"); in test_cmp_imm()
429 MK_INSN(cmp_test2, "mov $0x34, %al\n\t" in test_cmp_imm()
430 "cmp $0x39, %al\n\t"); in test_cmp_imm()
431 MK_INSN(cmp_test3, "mov $0x34, %al\n\t" in test_cmp_imm()
432 "cmp $0x24, %al\n\t"); in test_cmp_imm()
438 * in a 0 writeback, or 0 register in test_cmp_imm()
441 report("cmp 1", ~0, (outregs.eflags & (1<<6)) == (1<<6)); in test_cmp_imm()
444 report("cmp 2", ~0, (outregs.eflags & (1<<6)) == 0); in test_cmp_imm()
447 report("cmp 3", ~0, (outregs.eflags & (1<<6)) == 0); in test_cmp_imm()
452 MK_INSN(add_test1, "mov $0x43211234, %eax \n\t" in test_add_imm()
453 "add $0x12344321, %eax \n\t"); in test_add_imm()
454 MK_INSN(add_test2, "mov $0x12, %eax \n\t" in test_add_imm()
455 "add $0x21, %al\n\t"); in test_add_imm()
460 report("add 1", ~0, outregs.eax == 0x55555555); in test_add_imm()
463 report("add 2", ~0, outregs.eax == 0x33); in test_add_imm()
478 report("clc", ~0, (outregs.eflags & 1) == 0); in test_eflags_insn()
481 report("stc", ~0, (outregs.eflags & 1) == 1); in test_eflags_insn()
484 report("cli", ~0, !(outregs.eflags & (1 << 9))); in test_eflags_insn()
487 report("sti", ~0, outregs.eflags & (1 << 9)); in test_eflags_insn()
490 report("cld", ~0, !(outregs.eflags & (1 << 10))); in test_eflags_insn()
493 report("std", ~0, (outregs.eflags & (1 << 10))); in test_eflags_insn()
498 MK_INSN(io_test1, "mov $0xff, %al \n\t" in test_io()
499 "out %al, $0xe0 \n\t" in test_io()
500 "mov $0x00, %al \n\t" in test_io()
501 "in $0xe0, %al \n\t"); in test_io()
502 MK_INSN(io_test2, "mov $0xffff, %ax \n\t" in test_io()
503 "out %ax, $0xe0 \n\t" in test_io()
504 "mov $0x0000, %ax \n\t" in test_io()
505 "in $0xe0, %ax \n\t"); in test_io()
506 MK_INSN(io_test3, "mov $0xffffffff, %eax \n\t" in test_io()
507 "out %eax, $0xe0 \n\t" in test_io()
508 "mov $0x000000, %eax \n\t" in test_io()
509 "in $0xe0, %eax \n\t"); in test_io()
510 MK_INSN(io_test4, "mov $0xe0, %dx \n\t" in test_io()
511 "mov $0xff, %al \n\t" in test_io()
513 "mov $0x00, %al \n\t" in test_io()
515 MK_INSN(io_test5, "mov $0xe0, %dx \n\t" in test_io()
516 "mov $0xffff, %ax \n\t" in test_io()
518 "mov $0x0000, %ax \n\t" in test_io()
520 MK_INSN(io_test6, "mov $0xe0, %dx \n\t" in test_io()
521 "mov $0xffffffff, %eax \n\t" in test_io()
523 "mov $0x00000000, %eax \n\t" in test_io()
529 report("pio 1", R_AX, outregs.eax == 0xff); in test_io()
532 report("pio 2", R_AX, outregs.eax == 0xffff); in test_io()
535 report("pio 3", R_AX, outregs.eax == 0xffffffff); in test_io()
538 report("pio 4", R_AX|R_DX, outregs.eax == 0xff); in test_io()
541 report("pio 5", R_AX|R_DX, outregs.eax == 0xffff); in test_io()
544 report("pio 6", R_AX|R_DX, outregs.eax == 0xffffffff); in test_io()
560 "1: mov $0x1234, %eax\n\t" in test_call()
565 "1: mov $0x1234, %eax\n\t" in test_call()
569 MK_INSN(call_far2, "lcallw $0, $retf\n\t"); in test_call()
571 MK_INSN(retf_imm, "sub $10, %sp; lcallw $0, $retf_imm"); in test_call()
576 report("call 1", R_AX, outregs.eax == 0x1234); in test_call()
579 report("call near 1", R_AX, outregs.eax == 0x1234); in test_call()
582 report("call near 2", R_AX, outregs.eax == 0x1234); in test_call()
584 addr = (((unsigned)retf >> 4) << 16) | ((unsigned)retf & 0x0f); in test_call()
587 report("call far 1", 0, 1); in test_call()
590 report("call far 2", 0, 1); in test_call()
593 report("ret imm 1", 0, 1); in test_call()
596 report("retf imm 1", 0, 1); in test_call()
602 "mov $0x1234, %eax\n\t" in test_jcc_short()
605 "cmp $0x1234, %eax\n\t" in test_jcc_short()
606 "mov $0x1234, %eax\n\t" in test_jcc_short()
609 "mov $0x1234, %eax\n\t" in test_jcc_short()
615 report("jnz short 1", ~0, 1); in test_jcc_short()
621 report("jmp short 1", ~0, 1); in test_jcc_short()
627 MK_INSN(jnz_near1, ".byte 0x0f, 0x85, 0x06, 0x00\n\t" in test_jcc_near()
628 "mov $0x1234, %eax\n\t"); in test_jcc_near()
629 MK_INSN(jnz_near2, "cmp $0x1234, %eax\n\t" in test_jcc_near()
630 "mov $0x1234, %eax\n\t" in test_jcc_near()
631 ".byte 0x0f, 0x85, 0xf0, 0xff\n\t"); in test_jcc_near()
632 MK_INSN(jmp_near1, ".byte 0xE9, 0x06, 0x00\n\t" in test_jcc_near()
633 "mov $0x1234, %eax\n\t"); in test_jcc_near()
638 report("jnz near 1", 0, 1); in test_jcc_near()
644 report("jmp near 1", 0, 1); in test_jcc_near()
651 "1: jmp $0, $test_function\n\t" in test_long_jmp()
657 report("jmp far 1", R_AX, outregs.eax == 0x1234); in test_long_jmp()
662 MK_INSN(push32, "mov $0x12345678, %eax\n\t" in test_push_pop()
665 MK_INSN(push16, "mov $0x1234, %ax\n\t" in test_push_pop()
669 MK_INSN(push_es, "mov $0x231, %bx\n\t" //Just write a dummy value to see if it gets overwritten in test_push_pop()
670 "mov $0x123, %ax\n\t" in test_push_pop()
692 "xor $0x12340000, %esp \n\t" in test_push_pop()
694 "xor $0x12340000, %esp \n\t" in test_push_pop()
701 outregs.eax == outregs.ebx && outregs.eax == 0x12345678); in test_push_pop()
705 outregs.eax == outregs.ebx && outregs.eax == 0x1234); in test_push_pop()
709 outregs.ebx == outregs.eax && outregs.eax == 0x123); in test_push_pop()
720 inregs.eax = 0x9977; in test_push_pop()
721 inregs.ebx = 0x7799; in test_push_pop()
723 report("push/pop with high bits set in %esp", R_BX, outregs.ebx == 0x9977); in test_push_pop()
733 report("null", 0, 1); in test_null()
760 …init_inregs(&(struct regs){ .eax = 0, .ebx = 1, .ecx = 2, .edx = 3, .esi = 4, .edi = 5, .ebp = 6 }… in test_pusha_popa()
763 report("pusha/popa 1", 0, 1); in test_pusha_popa()
766 report("pusha/popa 1", 0, 1); in test_pusha_popa()
788 "andl $~0x2, %eax\n\t" in test_iret()
789 "orl $0xffc18028, %eax\n\t" in test_iret()
799 "and $~0x2, %ax\n\t" in test_iret()
800 "or $0x8028, %ax\n\t" in test_iret()
811 report("iret 1", 0, 1); in test_iret()
814 report("iret 2", 0, 1); in test_iret()
818 report("rflags.rf", ~0, !(outregs.eflags & (1 << 16))); in test_iret()
828 *(u32 *)(0x11 * 4) = 0x1000; /* Store a pointer to address 0x1000 in IDT entry 0x11 */ in test_int()
829 *(u8 *)(0x1000) = 0xcf; /* 0x1000 contains an IRET instruction */ in test_int()
831 MK_INSN(int11, "int $0x11\n\t"); in test_int()
834 report("int 1", 0, 1); in test_int()
841 *(u32 *)(0x73 * 4) = 0x1000; /* Store IRQ 11 handler in the IDT */ in test_sti_inhibit()
842 *(u8 *)(0x1000) = 0xcf; /* 0x1000 contains an IRET instruction */ in test_sti_inhibit()
845 "movw $0x200b, %dx\n\t" in test_sti_inhibit()
848 "movl $0, %eax\n\t" in test_sti_inhibit()
854 report("sti inhibit", ~0, 1); in test_sti_inhibit()
871 MK_INSN(imul8_2, "mov $0x12340002, %eax\n\t" in test_imul()
886 report("imul 1", R_AX | R_CX | R_DX, (outregs.eax & 0xff) == (u8)-8); in test_imul()
896 (outregs.eax & 0xffff) == 8 in test_imul()
897 && (outregs.eax & 0xffff0000) == 0x12340000); in test_imul()
923 report("mul 1", R_AX | R_CX | R_DX, (outregs.eax & 0xff) == 8); in test_mul()
988 MK_INSN(cbw, "mov $0xFE, %eax \n\t" in test_cbw()
990 MK_INSN(cwde, "mov $0xFFFE, %eax \n\t" in test_cbw()
996 report("cbq 1", ~0, outregs.eax == 0xFFFE); in test_cbw()
999 report("cwde 1", ~0, outregs.eax == 0xFFFFFFFE); in test_cbw()
1029 outregs.eax == 0 && outregs.ecx == 5); in test_loopcc()
1035 u16 nr_fail = 0; in test_das()
1037 0x46000000, 0x8701a000, 0x9710fa00, 0x97119a00, in test_das()
1038 0x02000101, 0x8301a101, 0x9310fb01, 0x93119b01, in test_das()
1039 0x02000202, 0x8301a202, 0x9710fc02, 0x97119c02, in test_das()
1040 0x06000303, 0x8701a303, 0x9310fd03, 0x93119d03, in test_das()
1041 0x02000404, 0x8301a404, 0x9310fe04, 0x93119e04, in test_das()
1042 0x06000505, 0x8701a505, 0x9710ff05, 0x97119f05, in test_das()
1043 0x06000606, 0x8701a606, 0x56100006, 0x9711a006, in test_das()
1044 0x02000707, 0x8301a707, 0x12100107, 0x9311a107, in test_das()
1045 0x02000808, 0x8301a808, 0x12100208, 0x9311a208, in test_das()
1046 0x06000909, 0x8701a909, 0x16100309, 0x9711a309, in test_das()
1047 0x1200040a, 0x9301a40a, 0x1210040a, 0x9311a40a, in test_das()
1048 0x1600050b, 0x9701a50b, 0x1610050b, 0x9711a50b, in test_das()
1049 0x1600060c, 0x9701a60c, 0x1610060c, 0x9711a60c, in test_das()
1050 0x1200070d, 0x9301a70d, 0x1210070d, 0x9311a70d, in test_das()
1051 0x1200080e, 0x9301a80e, 0x1210080e, 0x9311a80e, in test_das()
1052 0x1600090f, 0x9701a90f, 0x1610090f, 0x9711a90f, in test_das()
1053 0x02001010, 0x8301b010, 0x16100a10, 0x9711aa10, in test_das()
1054 0x06001111, 0x8701b111, 0x12100b11, 0x9311ab11, in test_das()
1055 0x06001212, 0x8701b212, 0x16100c12, 0x9711ac12, in test_das()
1056 0x02001313, 0x8301b313, 0x12100d13, 0x9311ad13, in test_das()
1057 0x06001414, 0x8701b414, 0x12100e14, 0x9311ae14, in test_das()
1058 0x02001515, 0x8301b515, 0x16100f15, 0x9711af15, in test_das()
1059 0x02001616, 0x8301b616, 0x12101016, 0x9311b016, in test_das()
1060 0x06001717, 0x8701b717, 0x16101117, 0x9711b117, in test_das()
1061 0x06001818, 0x8701b818, 0x16101218, 0x9711b218, in test_das()
1062 0x02001919, 0x8301b919, 0x12101319, 0x9311b319, in test_das()
1063 0x1600141a, 0x9701b41a, 0x1610141a, 0x9711b41a, in test_das()
1064 0x1200151b, 0x9301b51b, 0x1210151b, 0x9311b51b, in test_das()
1065 0x1200161c, 0x9301b61c, 0x1210161c, 0x9311b61c, in test_das()
1066 0x1600171d, 0x9701b71d, 0x1610171d, 0x9711b71d, in test_das()
1067 0x1600181e, 0x9701b81e, 0x1610181e, 0x9711b81e, in test_das()
1068 0x1200191f, 0x9301b91f, 0x1210191f, 0x9311b91f, in test_das()
1069 0x02002020, 0x8701c020, 0x12101a20, 0x9311ba20, in test_das()
1070 0x06002121, 0x8301c121, 0x16101b21, 0x9711bb21, in test_das()
1071 0x06002222, 0x8301c222, 0x12101c22, 0x9311bc22, in test_das()
1072 0x02002323, 0x8701c323, 0x16101d23, 0x9711bd23, in test_das()
1073 0x06002424, 0x8301c424, 0x16101e24, 0x9711be24, in test_das()
1074 0x02002525, 0x8701c525, 0x12101f25, 0x9311bf25, in test_das()
1075 0x02002626, 0x8701c626, 0x12102026, 0x9711c026, in test_das()
1076 0x06002727, 0x8301c727, 0x16102127, 0x9311c127, in test_das()
1077 0x06002828, 0x8301c828, 0x16102228, 0x9311c228, in test_das()
1078 0x02002929, 0x8701c929, 0x12102329, 0x9711c329, in test_das()
1079 0x1600242a, 0x9301c42a, 0x1610242a, 0x9311c42a, in test_das()
1080 0x1200252b, 0x9701c52b, 0x1210252b, 0x9711c52b, in test_das()
1081 0x1200262c, 0x9701c62c, 0x1210262c, 0x9711c62c, in test_das()
1082 0x1600272d, 0x9301c72d, 0x1610272d, 0x9311c72d, in test_das()
1083 0x1600282e, 0x9301c82e, 0x1610282e, 0x9311c82e, in test_das()
1084 0x1200292f, 0x9701c92f, 0x1210292f, 0x9711c92f, in test_das()
1085 0x06003030, 0x8301d030, 0x12102a30, 0x9711ca30, in test_das()
1086 0x02003131, 0x8701d131, 0x16102b31, 0x9311cb31, in test_das()
1087 0x02003232, 0x8701d232, 0x12102c32, 0x9711cc32, in test_das()
1088 0x06003333, 0x8301d333, 0x16102d33, 0x9311cd33, in test_das()
1089 0x02003434, 0x8701d434, 0x16102e34, 0x9311ce34, in test_das()
1090 0x06003535, 0x8301d535, 0x12102f35, 0x9711cf35, in test_das()
1091 0x06003636, 0x8301d636, 0x16103036, 0x9311d036, in test_das()
1092 0x02003737, 0x8701d737, 0x12103137, 0x9711d137, in test_das()
1093 0x02003838, 0x8701d838, 0x12103238, 0x9711d238, in test_das()
1094 0x06003939, 0x8301d939, 0x16103339, 0x9311d339, in test_das()
1095 0x1200343a, 0x9701d43a, 0x1210343a, 0x9711d43a, in test_das()
1096 0x1600353b, 0x9301d53b, 0x1610353b, 0x9311d53b, in test_das()
1097 0x1600363c, 0x9301d63c, 0x1610363c, 0x9311d63c, in test_das()
1098 0x1200373d, 0x9701d73d, 0x1210373d, 0x9711d73d, in test_das()
1099 0x1200383e, 0x9701d83e, 0x1210383e, 0x9711d83e, in test_das()
1100 0x1600393f, 0x9301d93f, 0x1610393f, 0x9311d93f, in test_das()
1101 0x02004040, 0x8301e040, 0x16103a40, 0x9311da40, in test_das()
1102 0x06004141, 0x8701e141, 0x12103b41, 0x9711db41, in test_das()
1103 0x06004242, 0x8701e242, 0x16103c42, 0x9311dc42, in test_das()
1104 0x02004343, 0x8301e343, 0x12103d43, 0x9711dd43, in test_das()
1105 0x06004444, 0x8701e444, 0x12103e44, 0x9711de44, in test_das()
1106 0x02004545, 0x8301e545, 0x16103f45, 0x9311df45, in test_das()
1107 0x02004646, 0x8301e646, 0x12104046, 0x9311e046, in test_das()
1108 0x06004747, 0x8701e747, 0x16104147, 0x9711e147, in test_das()
1109 0x06004848, 0x8701e848, 0x16104248, 0x9711e248, in test_das()
1110 0x02004949, 0x8301e949, 0x12104349, 0x9311e349, in test_das()
1111 0x1600444a, 0x9701e44a, 0x1610444a, 0x9711e44a, in test_das()
1112 0x1200454b, 0x9301e54b, 0x1210454b, 0x9311e54b, in test_das()
1113 0x1200464c, 0x9301e64c, 0x1210464c, 0x9311e64c, in test_das()
1114 0x1600474d, 0x9701e74d, 0x1610474d, 0x9711e74d, in test_das()
1115 0x1600484e, 0x9701e84e, 0x1610484e, 0x9711e84e, in test_das()
1116 0x1200494f, 0x9301e94f, 0x1210494f, 0x9311e94f, in test_das()
1117 0x06005050, 0x8701f050, 0x12104a50, 0x9311ea50, in test_das()
1118 0x02005151, 0x8301f151, 0x16104b51, 0x9711eb51, in test_das()
1119 0x02005252, 0x8301f252, 0x12104c52, 0x9311ec52, in test_das()
1120 0x06005353, 0x8701f353, 0x16104d53, 0x9711ed53, in test_das()
1121 0x02005454, 0x8301f454, 0x16104e54, 0x9711ee54, in test_das()
1122 0x06005555, 0x8701f555, 0x12104f55, 0x9311ef55, in test_das()
1123 0x06005656, 0x8701f656, 0x16105056, 0x9711f056, in test_das()
1124 0x02005757, 0x8301f757, 0x12105157, 0x9311f157, in test_das()
1125 0x02005858, 0x8301f858, 0x12105258, 0x9311f258, in test_das()
1126 0x06005959, 0x8701f959, 0x16105359, 0x9711f359, in test_das()
1127 0x1200545a, 0x9301f45a, 0x1210545a, 0x9311f45a, in test_das()
1128 0x1600555b, 0x9701f55b, 0x1610555b, 0x9711f55b, in test_das()
1129 0x1600565c, 0x9701f65c, 0x1610565c, 0x9711f65c, in test_das()
1130 0x1200575d, 0x9301f75d, 0x1210575d, 0x9311f75d, in test_das()
1131 0x1200585e, 0x9301f85e, 0x1210585e, 0x9311f85e, in test_das()
1132 0x1600595f, 0x9701f95f, 0x1610595f, 0x9711f95f, in test_das()
1133 0x06006060, 0x47010060, 0x16105a60, 0x9711fa60, in test_das()
1134 0x02006161, 0x03010161, 0x12105b61, 0x9311fb61, in test_das()
1135 0x02006262, 0x03010262, 0x16105c62, 0x9711fc62, in test_das()
1136 0x06006363, 0x07010363, 0x12105d63, 0x9311fd63, in test_das()
1137 0x02006464, 0x03010464, 0x12105e64, 0x9311fe64, in test_das()
1138 0x06006565, 0x07010565, 0x16105f65, 0x9711ff65, in test_das()
1139 0x06006666, 0x07010666, 0x16106066, 0x57110066, in test_das()
1140 0x02006767, 0x03010767, 0x12106167, 0x13110167, in test_das()
1141 0x02006868, 0x03010868, 0x12106268, 0x13110268, in test_das()
1142 0x06006969, 0x07010969, 0x16106369, 0x17110369, in test_das()
1143 0x1200646a, 0x1301046a, 0x1210646a, 0x1311046a, in test_das()
1144 0x1600656b, 0x1701056b, 0x1610656b, 0x1711056b, in test_das()
1145 0x1600666c, 0x1701066c, 0x1610666c, 0x1711066c, in test_das()
1146 0x1200676d, 0x1301076d, 0x1210676d, 0x1311076d, in test_das()
1147 0x1200686e, 0x1301086e, 0x1210686e, 0x1311086e, in test_das()
1148 0x1600696f, 0x1701096f, 0x1610696f, 0x1711096f, in test_das()
1149 0x02007070, 0x03011070, 0x16106a70, 0x17110a70, in test_das()
1150 0x06007171, 0x07011171, 0x12106b71, 0x13110b71, in test_das()
1151 0x06007272, 0x07011272, 0x16106c72, 0x17110c72, in test_das()
1152 0x02007373, 0x03011373, 0x12106d73, 0x13110d73, in test_das()
1153 0x06007474, 0x07011474, 0x12106e74, 0x13110e74, in test_das()
1154 0x02007575, 0x03011575, 0x16106f75, 0x17110f75, in test_das()
1155 0x02007676, 0x03011676, 0x12107076, 0x13111076, in test_das()
1156 0x06007777, 0x07011777, 0x16107177, 0x17111177, in test_das()
1157 0x06007878, 0x07011878, 0x16107278, 0x17111278, in test_das()
1158 0x02007979, 0x03011979, 0x12107379, 0x13111379, in test_das()
1159 0x1600747a, 0x1701147a, 0x1610747a, 0x1711147a, in test_das()
1160 0x1200757b, 0x1301157b, 0x1210757b, 0x1311157b, in test_das()
1161 0x1200767c, 0x1301167c, 0x1210767c, 0x1311167c, in test_das()
1162 0x1600777d, 0x1701177d, 0x1610777d, 0x1711177d, in test_das()
1163 0x1600787e, 0x1701187e, 0x1610787e, 0x1711187e, in test_das()
1164 0x1200797f, 0x1301197f, 0x1210797f, 0x1311197f, in test_das()
1165 0x82008080, 0x03012080, 0x12107a80, 0x13111a80, in test_das()
1166 0x86008181, 0x07012181, 0x16107b81, 0x17111b81, in test_das()
1167 0x86008282, 0x07012282, 0x12107c82, 0x13111c82, in test_das()
1168 0x82008383, 0x03012383, 0x16107d83, 0x17111d83, in test_das()
1169 0x86008484, 0x07012484, 0x16107e84, 0x17111e84, in test_das()
1170 0x82008585, 0x03012585, 0x12107f85, 0x13111f85, in test_das()
1171 0x82008686, 0x03012686, 0x92108086, 0x13112086, in test_das()
1172 0x86008787, 0x07012787, 0x96108187, 0x17112187, in test_das()
1173 0x86008888, 0x07012888, 0x96108288, 0x17112288, in test_das()
1174 0x82008989, 0x03012989, 0x92108389, 0x13112389, in test_das()
1175 0x9600848a, 0x1701248a, 0x9610848a, 0x1711248a, in test_das()
1176 0x9200858b, 0x1301258b, 0x9210858b, 0x1311258b, in test_das()
1177 0x9200868c, 0x1301268c, 0x9210868c, 0x1311268c, in test_das()
1178 0x9600878d, 0x1701278d, 0x9610878d, 0x1711278d, in test_das()
1179 0x9600888e, 0x1701288e, 0x9610888e, 0x1711288e, in test_das()
1180 0x9200898f, 0x1301298f, 0x9210898f, 0x1311298f, in test_das()
1181 0x86009090, 0x07013090, 0x92108a90, 0x13112a90, in test_das()
1182 0x82009191, 0x03013191, 0x96108b91, 0x17112b91, in test_das()
1183 0x82009292, 0x03013292, 0x92108c92, 0x13112c92, in test_das()
1184 0x86009393, 0x07013393, 0x96108d93, 0x17112d93, in test_das()
1185 0x82009494, 0x03013494, 0x96108e94, 0x17112e94, in test_das()
1186 0x86009595, 0x07013595, 0x92108f95, 0x13112f95, in test_das()
1187 0x86009696, 0x07013696, 0x96109096, 0x17113096, in test_das()
1188 0x82009797, 0x03013797, 0x92109197, 0x13113197, in test_das()
1189 0x82009898, 0x03013898, 0x92109298, 0x13113298, in test_das()
1190 0x86009999, 0x07013999, 0x96109399, 0x17113399, in test_das()
1191 0x1300349a, 0x1301349a, 0x1310349a, 0x1311349a, in test_das()
1192 0x1700359b, 0x1701359b, 0x1710359b, 0x1711359b, in test_das()
1193 0x1700369c, 0x1701369c, 0x1710369c, 0x1711369c, in test_das()
1194 0x1300379d, 0x1301379d, 0x1310379d, 0x1311379d, in test_das()
1195 0x1300389e, 0x1301389e, 0x1310389e, 0x1311389e, in test_das()
1196 0x1700399f, 0x1701399f, 0x1710399f, 0x1711399f, in test_das()
1197 0x030040a0, 0x030140a0, 0x17103aa0, 0x17113aa0, in test_das()
1198 0x070041a1, 0x070141a1, 0x13103ba1, 0x13113ba1, in test_das()
1199 0x070042a2, 0x070142a2, 0x17103ca2, 0x17113ca2, in test_das()
1200 0x030043a3, 0x030143a3, 0x13103da3, 0x13113da3, in test_das()
1201 0x070044a4, 0x070144a4, 0x13103ea4, 0x13113ea4, in test_das()
1202 0x030045a5, 0x030145a5, 0x17103fa5, 0x17113fa5, in test_das()
1203 0x030046a6, 0x030146a6, 0x131040a6, 0x131140a6, in test_das()
1204 0x070047a7, 0x070147a7, 0x171041a7, 0x171141a7, in test_das()
1205 0x070048a8, 0x070148a8, 0x171042a8, 0x171142a8, in test_das()
1206 0x030049a9, 0x030149a9, 0x131043a9, 0x131143a9, in test_das()
1207 0x170044aa, 0x170144aa, 0x171044aa, 0x171144aa, in test_das()
1208 0x130045ab, 0x130145ab, 0x131045ab, 0x131145ab, in test_das()
1209 0x130046ac, 0x130146ac, 0x131046ac, 0x131146ac, in test_das()
1210 0x170047ad, 0x170147ad, 0x171047ad, 0x171147ad, in test_das()
1211 0x170048ae, 0x170148ae, 0x171048ae, 0x171148ae, in test_das()
1212 0x130049af, 0x130149af, 0x131049af, 0x131149af, in test_das()
1213 0x070050b0, 0x070150b0, 0x13104ab0, 0x13114ab0, in test_das()
1214 0x030051b1, 0x030151b1, 0x17104bb1, 0x17114bb1, in test_das()
1215 0x030052b2, 0x030152b2, 0x13104cb2, 0x13114cb2, in test_das()
1216 0x070053b3, 0x070153b3, 0x17104db3, 0x17114db3, in test_das()
1217 0x030054b4, 0x030154b4, 0x17104eb4, 0x17114eb4, in test_das()
1218 0x070055b5, 0x070155b5, 0x13104fb5, 0x13114fb5, in test_das()
1219 0x070056b6, 0x070156b6, 0x171050b6, 0x171150b6, in test_das()
1220 0x030057b7, 0x030157b7, 0x131051b7, 0x131151b7, in test_das()
1221 0x030058b8, 0x030158b8, 0x131052b8, 0x131152b8, in test_das()
1222 0x070059b9, 0x070159b9, 0x171053b9, 0x171153b9, in test_das()
1223 0x130054ba, 0x130154ba, 0x131054ba, 0x131154ba, in test_das()
1224 0x170055bb, 0x170155bb, 0x171055bb, 0x171155bb, in test_das()
1225 0x170056bc, 0x170156bc, 0x171056bc, 0x171156bc, in test_das()
1226 0x130057bd, 0x130157bd, 0x131057bd, 0x131157bd, in test_das()
1227 0x130058be, 0x130158be, 0x131058be, 0x131158be, in test_das()
1228 0x170059bf, 0x170159bf, 0x171059bf, 0x171159bf, in test_das()
1229 0x070060c0, 0x070160c0, 0x17105ac0, 0x17115ac0, in test_das()
1230 0x030061c1, 0x030161c1, 0x13105bc1, 0x13115bc1, in test_das()
1231 0x030062c2, 0x030162c2, 0x17105cc2, 0x17115cc2, in test_das()
1232 0x070063c3, 0x070163c3, 0x13105dc3, 0x13115dc3, in test_das()
1233 0x030064c4, 0x030164c4, 0x13105ec4, 0x13115ec4, in test_das()
1234 0x070065c5, 0x070165c5, 0x17105fc5, 0x17115fc5, in test_das()
1235 0x070066c6, 0x070166c6, 0x171060c6, 0x171160c6, in test_das()
1236 0x030067c7, 0x030167c7, 0x131061c7, 0x131161c7, in test_das()
1237 0x030068c8, 0x030168c8, 0x131062c8, 0x131162c8, in test_das()
1238 0x070069c9, 0x070169c9, 0x171063c9, 0x171163c9, in test_das()
1239 0x130064ca, 0x130164ca, 0x131064ca, 0x131164ca, in test_das()
1240 0x170065cb, 0x170165cb, 0x171065cb, 0x171165cb, in test_das()
1241 0x170066cc, 0x170166cc, 0x171066cc, 0x171166cc, in test_das()
1242 0x130067cd, 0x130167cd, 0x131067cd, 0x131167cd, in test_das()
1243 0x130068ce, 0x130168ce, 0x131068ce, 0x131168ce, in test_das()
1244 0x170069cf, 0x170169cf, 0x171069cf, 0x171169cf, in test_das()
1245 0x030070d0, 0x030170d0, 0x17106ad0, 0x17116ad0, in test_das()
1246 0x070071d1, 0x070171d1, 0x13106bd1, 0x13116bd1, in test_das()
1247 0x070072d2, 0x070172d2, 0x17106cd2, 0x17116cd2, in test_das()
1248 0x030073d3, 0x030173d3, 0x13106dd3, 0x13116dd3, in test_das()
1249 0x070074d4, 0x070174d4, 0x13106ed4, 0x13116ed4, in test_das()
1250 0x030075d5, 0x030175d5, 0x17106fd5, 0x17116fd5, in test_das()
1251 0x030076d6, 0x030176d6, 0x131070d6, 0x131170d6, in test_das()
1252 0x070077d7, 0x070177d7, 0x171071d7, 0x171171d7, in test_das()
1253 0x070078d8, 0x070178d8, 0x171072d8, 0x171172d8, in test_das()
1254 0x030079d9, 0x030179d9, 0x131073d9, 0x131173d9, in test_das()
1255 0x170074da, 0x170174da, 0x171074da, 0x171174da, in test_das()
1256 0x130075db, 0x130175db, 0x131075db, 0x131175db, in test_das()
1257 0x130076dc, 0x130176dc, 0x131076dc, 0x131176dc, in test_das()
1258 0x170077dd, 0x170177dd, 0x171077dd, 0x171177dd, in test_das()
1259 0x170078de, 0x170178de, 0x171078de, 0x171178de, in test_das()
1260 0x130079df, 0x130179df, 0x131079df, 0x131179df, in test_das()
1261 0x830080e0, 0x830180e0, 0x13107ae0, 0x13117ae0, in test_das()
1262 0x870081e1, 0x870181e1, 0x17107be1, 0x17117be1, in test_das()
1263 0x870082e2, 0x870182e2, 0x13107ce2, 0x13117ce2, in test_das()
1264 0x830083e3, 0x830183e3, 0x17107de3, 0x17117de3, in test_das()
1265 0x870084e4, 0x870184e4, 0x17107ee4, 0x17117ee4, in test_das()
1266 0x830085e5, 0x830185e5, 0x13107fe5, 0x13117fe5, in test_das()
1267 0x830086e6, 0x830186e6, 0x931080e6, 0x931180e6, in test_das()
1268 0x870087e7, 0x870187e7, 0x971081e7, 0x971181e7, in test_das()
1269 0x870088e8, 0x870188e8, 0x971082e8, 0x971182e8, in test_das()
1270 0x830089e9, 0x830189e9, 0x931083e9, 0x931183e9, in test_das()
1271 0x970084ea, 0x970184ea, 0x971084ea, 0x971184ea, in test_das()
1272 0x930085eb, 0x930185eb, 0x931085eb, 0x931185eb, in test_das()
1273 0x930086ec, 0x930186ec, 0x931086ec, 0x931186ec, in test_das()
1274 0x970087ed, 0x970187ed, 0x971087ed, 0x971187ed, in test_das()
1275 0x970088ee, 0x970188ee, 0x971088ee, 0x971188ee, in test_das()
1276 0x930089ef, 0x930189ef, 0x931089ef, 0x931189ef, in test_das()
1277 0x870090f0, 0x870190f0, 0x93108af0, 0x93118af0, in test_das()
1278 0x830091f1, 0x830191f1, 0x97108bf1, 0x97118bf1, in test_das()
1279 0x830092f2, 0x830192f2, 0x93108cf2, 0x93118cf2, in test_das()
1280 0x870093f3, 0x870193f3, 0x97108df3, 0x97118df3, in test_das()
1281 0x830094f4, 0x830194f4, 0x97108ef4, 0x97118ef4, in test_das()
1282 0x870095f5, 0x870195f5, 0x93108ff5, 0x93118ff5, in test_das()
1283 0x870096f6, 0x870196f6, 0x971090f6, 0x971190f6, in test_das()
1284 0x830097f7, 0x830197f7, 0x931091f7, 0x931191f7, in test_das()
1285 0x830098f8, 0x830198f8, 0x931092f8, 0x931192f8, in test_das()
1286 0x870099f9, 0x870199f9, 0x971093f9, 0x971193f9, in test_das()
1287 0x930094fa, 0x930194fa, 0x931094fa, 0x931194fa, in test_das()
1288 0x970095fb, 0x970195fb, 0x971095fb, 0x971195fb, in test_das()
1289 0x970096fc, 0x970196fc, 0x971096fc, 0x971196fc, in test_das()
1290 0x930097fd, 0x930197fd, 0x931097fd, 0x931197fd, in test_das()
1291 0x930098fe, 0x930198fe, 0x931098fe, 0x931198fe, in test_das()
1292 0x970099ff, 0x970199ff, 0x971099ff, 0x971199ff, in test_das()
1299 for (i = 0; i < 1024; ++i) { in test_das()
1301 inregs.eax = tmp & 0xff; in test_das()
1302 inregs.eflags = (tmp >> 16) & 0xff; in test_das()
1305 || outregs.eax != ((tmp >> 8) & 0xff) in test_das()
1306 || (outregs.eflags & 0xff) != (tmp >> 24)) { in test_das()
1311 report("DAS", ~0, nr_fail == 0); in test_das()
1317 MK_INSN(cwd_1, "mov $0x8000, %ax\n\t" in test_cwd_cdq()
1321 MK_INSN(cwd_2, "mov $0x1000, %ax\n\t" in test_cwd_cdq()
1325 MK_INSN(cdq_1, "mov $0x80000000, %eax\n\t" in test_cwd_cdq()
1329 MK_INSN(cdq_2, "mov $0x10000000, %eax\n\t" in test_cwd_cdq()
1336 outregs.eax == 0x8000 && outregs.edx == 0xffff); in test_cwd_cdq()
1340 outregs.eax == 0x1000 && outregs.edx == 0); in test_cwd_cdq()
1344 outregs.eax == 0x80000000 && outregs.edx == 0xffffffff); in test_cwd_cdq()
1348 outregs.eax == 0x10000000 && outregs.edx == 0); in test_cwd_cdq()
1355 (void *)0x1234,
1356 0x10,
1410 "mov $0x1234, %eax\n\t" in test_jcxz()
1412 MK_INSN(jcxz2, "mov $0x100, %ecx\n\t" in test_jcxz()
1414 "mov $0x1234, %eax\n\t" in test_jcxz()
1415 "mov $0, %ecx\n\t" in test_jcxz()
1417 MK_INSN(jcxz3, "mov $0x10000, %ecx\n\t" in test_jcxz()
1419 "mov $0x1234, %eax\n\t" in test_jcxz()
1422 "mov $0x1234, %eax\n\t" in test_jcxz()
1424 MK_INSN(jecxz2, "mov $0x10000, %ecx\n\t" in test_jcxz()
1426 "mov $0x1234, %eax\n\t" in test_jcxz()
1427 "mov $0, %ecx\n\t" in test_jcxz()
1433 report("jcxz short 1", 0, 1); in test_jcxz()
1436 report("jcxz short 2", R_AX, outregs.eax == 0x1234); in test_jcxz()
1439 report("jcxz short 3", R_CX, outregs.ecx == 0x10000); in test_jcxz()
1442 report("jecxz short 1", 0, 1); in test_jcxz()
1445 report("jecxz short 2", R_AX, outregs.eax == 0x1234); in test_jcxz()
1451 unsigned function = 0x1234; in test_cpuid()
1469 static unsigned array[] = { 0x12345678, 0, 0, 0, 0x87654321 }; in test_ss_base_for_esp_ebp()
1474 report("ss relative addressing (1)", R_AX | R_BX, outregs.ebx == 0x87654321); in test_ss_base_for_esp_ebp()
1478 inregs.edi = 0; in test_ss_base_for_esp_ebp()
1480 report("ss relative addressing (2)", R_AX | R_BX, outregs.ebx == 0x87654321); in test_ss_base_for_esp_ebp()
1493 asm volatile("sgdtw %0" : "=m"(x)); in test_sgdt_sidt()
1495 report("sgdt", 0, x.limit == y.limit && x.base == y.base); in test_sgdt_sidt()
1498 asm volatile("sidtw %0" : "=m"(x)); in test_sgdt_sidt()
1500 report("sidt", 0, x.limit == y.limit && x.base == y.base); in test_sgdt_sidt()
1507 init_inregs(&(struct regs){ .eax = 0xfd00 }); in test_sahf()
1510 report("sahf", R_AX, outregs.eax == (inregs.eax | 0xd7)); in test_sahf()
1517 init_inregs(&(struct regs){ .eax = 0xc7 }); in test_lahf()
1530 init_inregs(&(struct regs){ .eax = 0x1234569c }); in test_movzx_movsx()
1546 init_inregs(&(struct regs){ .ecx = 0x12345678 }); in test_bswap()
1549 report("bswap", R_CX, outregs.ecx == 0x78563412); in test_bswap()
1556 init_inregs(&(struct regs){ .eax = 0x12345678 }); in test_aad()
1559 report("aad", R_AX, outregs.eax == 0x123400d4); in test_aad()
1566 init_inregs(&(struct regs){ .eax = 0x76543210 }); in test_aam()
1569 report("aam", R_AX, outregs.eax == 0x76540106); in test_aam()
1578 for (i = 0; i < 256; i++) { in test_xlat()
1582 init_inregs(&(struct regs){ .eax = 0x89abcdef, .ebx = (u32)table }); in test_xlat()
1585 report("xlat", R_AX, outregs.eax == 0x89abcdf0); in test_xlat()
1590 MK_INSN(clc_salc, "clc; .byte 0xd6"); in test_salc()
1591 MK_INSN(stc_salc, "stc; .byte 0xd6"); in test_salc()
1593 init_inregs(&(struct regs){ .eax = 0x12345678 }); in test_salc()
1596 report("salc (1)", R_AX, outregs.eax == 0x12345600); in test_salc()
1598 report("salc (2)", R_AX, outregs.eax == 0x123456ff); in test_salc()
1609 report("fninit", 0, fsw == 0 && (fcw & 0x103f) == 0x003f); in test_fninit()
1614 MK_INSN(nopl1, ".byte 0x90\n\r"); // 1 byte nop in test_nopl()
1615 MK_INSN(nopl2, ".byte 0x66, 0x90\n\r"); // 2 bytes nop in test_nopl()
1616 MK_INSN(nopl3, ".byte 0x0f, 0x1f, 0x00\n\r"); // 3 bytes nop in test_nopl()
1617 MK_INSN(nopl4, ".byte 0x0f, 0x1f, 0x40, 0x00\n\r"); // 4 bytes nop in test_nopl()
1622 report("nopl", 0, 1); in test_nopl()
1632 ".byte 0x67; loop 1b\n" \
1687 MK_INSN_PERF(perf_memory_load, "cmpw $0, (%edi)"); in test_perf_memory_load()
1725 ".byte 0x0f \n\t .byte 0x21 \n\t .byte 0x0\n\t"); in test_dr_mod()
1727 init_inregs(&(struct regs){ .eax = 0xdead, .ebx = 0xaced }); in test_dr_mod()
1730 report("mov dr with mod bits", R_AX | R_BX, outregs.eax == 0xaced); in test_dr_mod()
1737 "or $0x40000000, %ebx\n\t" in test_smsw()
1742 init_inregs(&(struct regs){ .eax = 0x12345678 }); in test_smsw()
1752 init_inregs(&(struct regs){ .eax = 0x12345678 }); in test_xadd()
1819 unsigned long long r_gdt[] = { 0, 0x9b000000ffff, 0x93000000ffff };
1822 struct table_descr r_idt_descr = { 0x3ff, 0 };
1829 "mb_magic = 0x1BADB002 \n\t"
1830 "mb_flags = 0x0 \n\t"
1833 ".long mb_magic, mb_flags, 0 - (mb_magic + mb_flags) \n\t"
1853 "btc $0, %eax \n\t"
1855 "ljmp $0, $realmode_entry \n\t"
1866 "ljmp $0, $realmode_start \n\t"