Lines Matching +full:0 +full:x4000
59 #define CC_C 0x0001
60 #define CC_P 0x0004
61 #define CC_A 0x0010
62 #define CC_Z 0x0040
63 #define CC_S 0x0080
64 #define CC_O 0x0800
73 return v | ((v ^ 0xabcd) << 32); in i2l()
187 asm("lea " STR ", %0"\
195 asm("lea " STR ", %0"\
203 asm(".code16 ; .byte 0x67 ; leal " STR ", %0 ; .code32"\
213 eax = i2l(0x0001); in test_lea()
214 ebx = i2l(0x0002); in test_lea()
215 ecx = i2l(0x0004); in test_lea()
216 edx = i2l(0x0008); in test_lea()
217 esi = i2l(0x0010); in test_lea()
218 edi = i2l(0x0020); in test_lea()
220 TEST_LEA("0x4000"); in test_lea()
229 TEST_LEA("0x40(%%eax)"); in test_lea()
230 TEST_LEA("0x40(%%ebx)"); in test_lea()
231 TEST_LEA("0x40(%%ecx)"); in test_lea()
232 TEST_LEA("0x40(%%edx)"); in test_lea()
233 TEST_LEA("0x40(%%esi)"); in test_lea()
234 TEST_LEA("0x40(%%edi)"); in test_lea()
236 TEST_LEA("0x4000(%%eax)"); in test_lea()
237 TEST_LEA("0x4000(%%ebx)"); in test_lea()
238 TEST_LEA("0x4000(%%ecx)"); in test_lea()
239 TEST_LEA("0x4000(%%edx)"); in test_lea()
240 TEST_LEA("0x4000(%%esi)"); in test_lea()
241 TEST_LEA("0x4000(%%edi)"); in test_lea()
250 TEST_LEA("0x40(%%eax, %%ecx)"); in test_lea()
251 TEST_LEA("0x4000(%%ebx, %%edx)"); in test_lea()
261 TEST_LEA("0x40(,%%eax, 2)"); in test_lea()
262 TEST_LEA("0x40(,%%ebx, 4)"); in test_lea()
263 TEST_LEA("0x40(,%%ecx, 8)"); in test_lea()
270 TEST_LEA("0x4000(%%ecx, %%ecx, 2)"); in test_lea()
271 TEST_LEA("0x4000(%%edx, %%ecx, 4)"); in test_lea()
272 TEST_LEA("0x4000(%%esi, %%ecx, 8)"); in test_lea()
275 TEST_LEAQ("0x4000"); in test_lea()
276 TEST_LEAQ("0x4000(%%rip)"); in test_lea()
285 TEST_LEAQ("0x40(%%rax)"); in test_lea()
286 TEST_LEAQ("0x40(%%rbx)"); in test_lea()
287 TEST_LEAQ("0x40(%%rcx)"); in test_lea()
288 TEST_LEAQ("0x40(%%rdx)"); in test_lea()
289 TEST_LEAQ("0x40(%%rsi)"); in test_lea()
290 TEST_LEAQ("0x40(%%rdi)"); in test_lea()
292 TEST_LEAQ("0x4000(%%rax)"); in test_lea()
293 TEST_LEAQ("0x4000(%%rbx)"); in test_lea()
294 TEST_LEAQ("0x4000(%%rcx)"); in test_lea()
295 TEST_LEAQ("0x4000(%%rdx)"); in test_lea()
296 TEST_LEAQ("0x4000(%%rsi)"); in test_lea()
297 TEST_LEAQ("0x4000(%%rdi)"); in test_lea()
306 TEST_LEAQ("0x40(%%rax, %%rcx)"); in test_lea()
307 TEST_LEAQ("0x4000(%%rbx, %%rdx)"); in test_lea()
317 TEST_LEAQ("0x40(,%%rax, 2)"); in test_lea()
318 TEST_LEAQ("0x40(,%%rbx, 4)"); in test_lea()
319 TEST_LEAQ("0x40(,%%rcx, 8)"); in test_lea()
326 TEST_LEAQ("0x4000(%%rcx, %%rcx, 2)"); in test_lea()
327 TEST_LEAQ("0x4000(%%rdx, %%rcx, 4)"); in test_lea()
328 TEST_LEAQ("0x4000(%%rsi, %%rcx, 8)"); in test_lea()
331 TEST_LEA16("0x4000"); in test_lea()
335 TEST_LEA16("0x40(%%bx)"); in test_lea()
336 TEST_LEA16("0x40(%%si)"); in test_lea()
337 TEST_LEA16("0x40(%%di)"); in test_lea()
338 TEST_LEA16("0x4000(%%bx)"); in test_lea()
339 TEST_LEA16("0x4000(%%si)"); in test_lea()
342 TEST_LEA16("0x40(%%bx,%%si)"); in test_lea()
343 TEST_LEA16("0x40(%%bx,%%di)"); in test_lea()
344 TEST_LEA16("0x4000(%%bx,%%si)"); in test_lea()
345 TEST_LEA16("0x4000(%%bx,%%di)"); in test_lea()
352 asm("movl $1, %0\n\t"\
355 "movl $0, %0\n\t"\
361 asm("movl $0, %0\n\t"\
369 long res = i2l(0x12345678);\
372 "cmov" JCC "q %3, %0\n\t"\
374 : "r" (v1), "r" (v2), "m" (val), "0" (res));\
379 : "r" (v1), "r" (v2), "m" (val), "0" (res));\
384 : "r" (v1), "r" (v2), "r" (1), "0" (res));\
393 TEST_JCC("ne", 1, 0); in test_jcc()
396 TEST_JCC("e", 1, 0); in test_jcc()
399 TEST_JCC("l", 1, 0); in test_jcc()
403 TEST_JCC("le", 1, 0); in test_jcc()
407 TEST_JCC("ge", 1, 0); in test_jcc()
411 TEST_JCC("g", 1, 0); in test_jcc()
415 TEST_JCC("b", 1, 0); in test_jcc()
419 TEST_JCC("be", 1, 0); in test_jcc()
423 TEST_JCC("ae", 1, 0); in test_jcc()
427 TEST_JCC("a", 1, 0); in test_jcc()
432 TEST_JCC("p", 1, 0); in test_jcc()
435 TEST_JCC("np", 1, 0); in test_jcc()
437 TEST_JCC("o", 0x7fffffff, 0); in test_jcc()
438 TEST_JCC("o", 0x7fffffff, -1); in test_jcc()
440 TEST_JCC("no", 0x7fffffff, 0); in test_jcc()
441 TEST_JCC("no", 0x7fffffff, -1); in test_jcc()
443 TEST_JCC("s", 0, 1); in test_jcc()
444 TEST_JCC("s", 0, -1); in test_jcc()
445 TEST_JCC("s", 0, 0); in test_jcc()
447 TEST_JCC("ns", 0, 1); in test_jcc()
448 TEST_JCC("ns", 0, -1); in test_jcc()
449 TEST_JCC("ns", 0, 0); in test_jcc()
454 for(i = 0; i < sizeof(ecx_vals) / sizeof(long); i++) {\
456 for(zf = 0; zf < 2; zf++) {\
458 "movl $1, %0\n\t"\
460 "movl $0, %0\n\t"\
473 0, in test_loop()
475 0x10000, in test_loop()
476 0x10001, in test_loop()
478 0x100000000L, in test_loop()
479 0x100000001L, in test_loop()
516 flags = 0; in test_imulw2()
523 : "q" (s1), "0" (res), "1" (flags)); in test_imulw2()
534 flags = 0; in test_imull2()
541 : "q" (s1), "0" (res), "1" (flags)); in test_imull2()
553 flags = 0; in test_imulq2()
556 "imulq %2, %0\n\t" in test_imulq2()
560 : "q" (s1), "0" (res), "1" (flags)); in test_imulq2()
569 flags = 0;\
570 res = 0;\
574 "imul" size " $" #op0 ", %" rsize "2, %" rsize "0\n\t" \
578 : "r" (s1), "1" (flags), "0" (res));\
585 #define CC_MASK (0)
595 test_imulb(0x1234561d, 4); in test_mul()
597 test_imulb(0x80, 0x80); in test_mul()
598 test_imulb(0x10, 0x10); in test_mul()
600 test_imulw(0, 0x1234001d, 45); in test_mul()
601 test_imulw(0, 23, -45); in test_mul()
602 test_imulw(0, 0x8000, 0x8000); in test_mul()
603 test_imulw(0, 0x100, 0x100); in test_mul()
605 test_imull(0, 0x1234001d, 45); in test_mul()
606 test_imull(0, 23, -45); in test_mul()
607 test_imull(0, 0x80000000, 0x80000000); in test_mul()
608 test_imull(0, 0x10000, 0x10000); in test_mul()
610 test_mulb(0x1234561d, 4); in test_mul()
612 test_mulb(0x80, 0x80); in test_mul()
613 test_mulb(0x10, 0x10); in test_mul()
615 test_mulw(0, 0x1234001d, 45); in test_mul()
616 test_mulw(0, 23, -45); in test_mul()
617 test_mulw(0, 0x8000, 0x8000); in test_mul()
618 test_mulw(0, 0x100, 0x100); in test_mul()
620 test_mull(0, 0x1234001d, 45); in test_mul()
621 test_mull(0, 23, -45); in test_mul()
622 test_mull(0, 0x80000000, 0x80000000); in test_mul()
623 test_mull(0, 0x10000, 0x10000); in test_mul()
625 test_imulw2(0x1234001d, 45); in test_mul()
627 test_imulw2(0x8000, 0x8000); in test_mul()
628 test_imulw2(0x100, 0x100); in test_mul()
630 test_imull2(0x1234001d, 45); in test_mul()
632 test_imull2(0x80000000, 0x80000000); in test_mul()
633 test_imull2(0x10000, 0x10000); in test_mul()
635 TEST_IMUL_IM("w", "w", 45, 0x1234); in test_mul()
637 TEST_IMUL_IM("w", "w", 0x8000, 0x80000000); in test_mul()
638 TEST_IMUL_IM("w", "w", 0x7fff, 0x1000); in test_mul()
640 TEST_IMUL_IM("l", "k", 45, 0x1234); in test_mul()
642 TEST_IMUL_IM("l", "k", 0x8000, 0x80000000); in test_mul()
643 TEST_IMUL_IM("l", "k", 0x7fff, 0x1000); in test_mul()
645 test_idivb(0x12341678, 0x127e); in test_mul()
646 test_idivb(0x43210123, -5); in test_mul()
647 test_idivb(0x12340004, -1); in test_mul()
649 test_idivw(0, 0x12345678, 12347); in test_mul()
650 test_idivw(0, -23223, -45); in test_mul()
651 test_idivw(0, 0x12348000, -1); in test_mul()
652 test_idivw(0x12343, 0x12345678, 0x81238567); in test_mul()
654 test_idivl(0, 0x12345678, 12347); in test_mul()
655 test_idivl(0, -233223, -45); in test_mul()
656 test_idivl(0, 0x80000000, -1); in test_mul()
657 test_idivl(0x12343, 0x12345678, 0x81234567); in test_mul()
659 test_divb(0x12341678, 0x127e); in test_mul()
660 test_divb(0x43210123, -5); in test_mul()
661 test_divb(0x12340004, -1); in test_mul()
663 test_divw(0, 0x12345678, 12347); in test_mul()
664 test_divw(0, -23223, -45); in test_mul()
665 test_divw(0, 0x12348000, -1); in test_mul()
666 test_divw(0x12343, 0x12345678, 0x81238567); in test_mul()
668 test_divl(0, 0x12345678, 12347); in test_mul()
669 test_divl(0, -233223, -45); in test_mul()
670 test_divl(0, 0x80000000, -1); in test_mul()
671 test_divl(0x12343, 0x12345678, 0x81234567); in test_mul()
674 test_imulq(0, 0x1234001d1234001d, 45); in test_mul()
675 test_imulq(0, 23, -45); in test_mul()
676 test_imulq(0, 0x8000000000000000, 0x8000000000000000); in test_mul()
677 test_imulq(0, 0x100000000, 0x100000000); in test_mul()
679 test_mulq(0, 0x1234001d1234001d, 45); in test_mul()
680 test_mulq(0, 23, -45); in test_mul()
681 test_mulq(0, 0x8000000000000000, 0x8000000000000000); in test_mul()
682 test_mulq(0, 0x100000000, 0x100000000); in test_mul()
684 test_imulq2(0x1234001d1234001d, 45); in test_mul()
686 test_imulq2(0x8000000000000000, 0x8000000000000000); in test_mul()
687 test_imulq2(0x100000000, 0x100000000); in test_mul()
689 TEST_IMUL_IM("q", "", 45, 0x12341234); in test_mul()
691 TEST_IMUL_IM("q", "", 0x8000, 0x8000000000000000); in test_mul()
692 TEST_IMUL_IM("q", "", 0x7fff, 0x10000000); in test_mul()
694 test_idivq(0, 0x12345678abcdef, 12347); in test_mul()
695 test_idivq(0, -233223, -45); in test_mul()
696 test_idivq(0, 0x8000000000000000, -1); in test_mul()
697 test_idivq(0x12343, 0x12345678, 0x81234567); in test_mul()
699 test_divq(0, 0x12345678abcdef, 12347); in test_mul()
700 test_divq(0, -233223, -45); in test_mul()
701 test_divq(0, 0x8000000000000000, -1); in test_mul()
702 test_divq(0x12343, 0x12345678, 0x81234567); in test_mul()
711 "mov $0x12345678, %0\n"\
712 #op " %" size "2, %" size "0 ; setz %b1" \
720 TEST_BSX(tzcntw, "w", 0); in test_xcnt()
721 TEST_BSX(tzcntw, "w", 0x12340128); in test_xcnt()
722 TEST_BSX(lzcntw, "w", 0); in test_xcnt()
723 TEST_BSX(lzcntw, "w", 0x12340128); in test_xcnt()
724 TEST_BSX(popcntw, "w", 0); in test_xcnt()
725 TEST_BSX(popcntw, "w", 0x12340128); in test_xcnt()
726 TEST_BSX(tzcntl, "k", 0); in test_xcnt()
727 TEST_BSX(tzcntl, "k", 0x00340128); in test_xcnt()
728 TEST_BSX(lzcntl, "k", 0); in test_xcnt()
729 TEST_BSX(lzcntl, "k", 0x00340128); in test_xcnt()
730 TEST_BSX(popcntl, "k", 0); in test_xcnt()
731 TEST_BSX(popcntl, "k", 0x00340128); in test_xcnt()
733 TEST_BSX(tzcntq, "", 0); in test_xcnt()
734 TEST_BSX(tzcntq, "", 0x003401281234); in test_xcnt()
735 TEST_BSX(lzcntq, "", 0); in test_xcnt()
736 TEST_BSX(lzcntq, "", 0x003401281234); in test_xcnt()
737 TEST_BSX(popcntq, "", 0); in test_xcnt()
738 TEST_BSX(popcntq, "", 0x003401281234); in test_xcnt()
744 TEST_BSX(bsrw, "w", 0); in test_bsx()
745 TEST_BSX(bsrw, "w", 0x12340128); in test_bsx()
746 TEST_BSX(bsfw, "w", 0); in test_bsx()
747 TEST_BSX(bsfw, "w", 0x12340128); in test_bsx()
748 TEST_BSX(bsrl, "k", 0); in test_bsx()
749 TEST_BSX(bsrl, "k", 0x00340128); in test_bsx()
750 TEST_BSX(bsfl, "k", 0); in test_bsx()
751 TEST_BSX(bsfl, "k", 0x00340128); in test_bsx()
753 TEST_BSX(bsrq, "", 0); in test_bsx()
754 TEST_BSX(bsrq, "", 0x003401281234); in test_bsx()
755 TEST_BSX(bsfq, "", 0); in test_bsx()
756 TEST_BSX(bsfq, "", 0x003401281234); in test_bsx()
767 union float64u q_nan = { .l = 0xFFF8000000000000LL };
768 union float64u s_nan = { .l = 0xFFF0000000000000LL };
804 asm volatile ("fnstenv %0\n" : "=m" (float_env32)); in fpu_clear_exceptions()
805 float_env32.fpus &= ~0x7f; in fpu_clear_exceptions()
806 asm volatile ("fldenv %0\n" : : "m" (float_env32)); in fpu_clear_exceptions()
810 #define FPUS_EMASK 0x0000
811 //#define FPUS_EMASK 0x007f
823 a, b, fpus & (0x4500 | FPUS_EMASK)); in test_fcmp()
830 a, b, fpus & (0x4500 | FPUS_EMASK)); in test_fcmp()
837 "pop %0\n" in test_fcmp()
846 "pop %0\n" in test_fcmp()
857 printf("fxam(%f)=%04lx\n", a, fpus & 0x4700); in test_fcmp()
881 asm volatile ("fstcw %0" : "=m" (fpuc)); in test_fcvt()
882 for(i=0;i<4;i++) { in test_fcvt()
884 val16 = (fpuc & ~0x0c00) | (i << 10); in test_fcvt()
885 asm volatile ("fldcw %0" : : "m" (val16)); in test_fcvt()
886 asm volatile ("fists %0" : "=m" (wa) : "t" (a)); in test_fcvt()
887 asm volatile ("fistl %0" : "=m" (ia) : "t" (a)); in test_fcvt()
888 asm volatile ("fistpll %0" : "=m" (lla) : "t" (a) : "st"); in test_fcvt()
889 asm volatile ("frndint ; fstl %0" : "=m" (ra) : "t" (a)); in test_fcvt()
890 asm volatile ("fldcw %0" : : "m" (fpuc)); in test_fcvt()
919 asm("fbstp %0" : "=m" (bcd[0]) : "t" (a) : "st"); in test_fbcd()
920 asm("fbld %1" : "=t" (b) : "m" (bcd[0])); in test_fbcd()
922 a, bcd[4], bcd[3], bcd[2], bcd[1], bcd[0], b); in test_fbcd()
927 memset((env), 0xaa, sizeof(*(env)));\
928 for(i=0;i<5;i++)\
929 asm volatile ("fldl %0" : : "m" (dtab[i]));\
930 asm volatile (save " %0\n" : : "m" (*(env)));\
931 asm volatile (restore " %0\n": : "m" (*(env)));\
932 for(i=0;i<5;i++)\
933 asm volatile ("fstpl %0" : "=m" (rtab[i]));\
934 for(i=0;i<5;i++)\
938 (env)->fpus & 0xff00,\
965 for(i=0;i<8;i++) in test_fenv()
974 for(i=0;i<5;i++) in test_fenv()
975 asm volatile ("fldl %0" : : "m" (dtab[i])); in test_fenv()
977 asm volatile ("fnstenv %0\n" : : "m" (float_env32)); in test_fenv()
988 "fcmov" CC " %2, %0\n"\
990 : "0" (a), "u" (b), "g" (eflags));\
991 printf("fcmov%s eflags=0x%04lx-> %f\n", \
1002 for(i = 0; i < 4; i++) { in test_fcmov()
1003 eflags = 0; in test_fcmov()
1015 TEST_FCMOV(a, b, 0, "u"); in test_fcmov()
1017 TEST_FCMOV(a, b, 0, "nu"); in test_fcmov()
1064 : "0" (res), "1" (flags));\
1071 TEST_BCD(daa, 0x12340503, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1072 TEST_BCD(daa, 0x12340506, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1073 TEST_BCD(daa, 0x12340507, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1074 TEST_BCD(daa, 0x12340559, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1075 TEST_BCD(daa, 0x12340560, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1076 TEST_BCD(daa, 0x1234059f, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1077 TEST_BCD(daa, 0x123405a0, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1078 TEST_BCD(daa, 0x12340503, 0, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1079 TEST_BCD(daa, 0x12340506, 0, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1080 TEST_BCD(daa, 0x12340503, CC_C, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1081 TEST_BCD(daa, 0x12340506, CC_C, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1082 TEST_BCD(daa, 0x12340503, CC_C | CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1083 TEST_BCD(daa, 0x12340506, CC_C | CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1085 TEST_BCD(das, 0x12340503, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1086 TEST_BCD(das, 0x12340506, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1087 TEST_BCD(das, 0x12340507, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1088 TEST_BCD(das, 0x12340559, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1089 TEST_BCD(das, 0x12340560, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1090 TEST_BCD(das, 0x1234059f, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1091 TEST_BCD(das, 0x123405a0, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1092 TEST_BCD(das, 0x12340503, 0, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1093 TEST_BCD(das, 0x12340506, 0, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1094 TEST_BCD(das, 0x12340503, CC_C, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1095 TEST_BCD(das, 0x12340506, CC_C, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1096 TEST_BCD(das, 0x12340503, CC_C | CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1097 TEST_BCD(das, 0x12340506, CC_C | CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_A)); in test_bcd()
1099 TEST_BCD(aaa, 0x12340205, CC_A, (CC_C | CC_A)); in test_bcd()
1100 TEST_BCD(aaa, 0x12340306, CC_A, (CC_C | CC_A)); in test_bcd()
1101 TEST_BCD(aaa, 0x1234040a, CC_A, (CC_C | CC_A)); in test_bcd()
1102 TEST_BCD(aaa, 0x123405fa, CC_A, (CC_C | CC_A)); in test_bcd()
1103 TEST_BCD(aaa, 0x12340205, 0, (CC_C | CC_A)); in test_bcd()
1104 TEST_BCD(aaa, 0x12340306, 0, (CC_C | CC_A)); in test_bcd()
1105 TEST_BCD(aaa, 0x1234040a, 0, (CC_C | CC_A)); in test_bcd()
1106 TEST_BCD(aaa, 0x123405fa, 0, (CC_C | CC_A)); in test_bcd()
1108 TEST_BCD(aas, 0x12340205, CC_A, (CC_C | CC_A)); in test_bcd()
1109 TEST_BCD(aas, 0x12340306, CC_A, (CC_C | CC_A)); in test_bcd()
1110 TEST_BCD(aas, 0x1234040a, CC_A, (CC_C | CC_A)); in test_bcd()
1111 TEST_BCD(aas, 0x123405fa, CC_A, (CC_C | CC_A)); in test_bcd()
1112 TEST_BCD(aas, 0x12340205, 0, (CC_C | CC_A)); in test_bcd()
1113 TEST_BCD(aas, 0x12340306, 0, (CC_C | CC_A)); in test_bcd()
1114 TEST_BCD(aas, 0x1234040a, 0, (CC_C | CC_A)); in test_bcd()
1115 TEST_BCD(aas, 0x123405fa, 0, (CC_C | CC_A)); in test_bcd()
1117 TEST_BCD(aam, 0x12340547, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_O | CC_A)); in test_bcd()
1118 TEST_BCD(aad, 0x12340407, CC_A, (CC_C | CC_P | CC_Z | CC_S | CC_O | CC_A)); in test_bcd()
1125 op0 = i2l(0x12345678);\
1126 op1 = i2l(0xfbca7654);\
1127 asm(#op " %" size "0, %" size "1" \
1129 : "0" (op0));\
1137 op0 = i2l(0x12345678);\
1138 op1 = i2l(0xfbca7654);\
1140 asm(#op " %" size "0, %" size "1" \
1142 : "0" (op0), "a" (op2));\
1172 res = 0x12345678; in test_xchg()
1173 asm("xaddl %1, %0" : "=r" (res) : "0" (res)); in test_xchg()
1185 TEST_CMPXCHG(cmpxchgq, "", "+q", 0xfbca7654); in test_xchg()
1187 TEST_CMPXCHG(cmpxchgl, "k", "+q", 0xfbca7654); in test_xchg()
1188 TEST_CMPXCHG(cmpxchgw, "w", "+q", 0xfbca7654); in test_xchg()
1189 TEST_CMPXCHG(cmpxchgb, "b", "+q", 0xfbca7654); in test_xchg()
1192 TEST_CMPXCHG(cmpxchgq, "", "+q", 0xfffefdfc); in test_xchg()
1194 TEST_CMPXCHG(cmpxchgl, "k", "+q", 0xfffefdfc); in test_xchg()
1195 TEST_CMPXCHG(cmpxchgw, "w", "+q", 0xfffefdfc); in test_xchg()
1196 TEST_CMPXCHG(cmpxchgb, "b", "+q", 0xfffefdfc); in test_xchg()
1199 TEST_CMPXCHG(cmpxchgq, "", "+m", 0xfbca7654); in test_xchg()
1201 TEST_CMPXCHG(cmpxchgl, "k", "+m", 0xfbca7654); in test_xchg()
1202 TEST_CMPXCHG(cmpxchgw, "w", "+m", 0xfbca7654); in test_xchg()
1203 TEST_CMPXCHG(cmpxchgb, "b", "+m", 0xfbca7654); in test_xchg()
1206 TEST_CMPXCHG(cmpxchgq, "", "+m", 0xfffefdfc); in test_xchg()
1208 TEST_CMPXCHG(cmpxchgl, "k", "+m", 0xfffefdfc); in test_xchg()
1209 TEST_CMPXCHG(cmpxchgw, "w", "+m", 0xfffefdfc); in test_xchg()
1210 TEST_CMPXCHG(cmpxchgb, "b", "+m", 0xfffefdfc); in test_xchg()
1217 for(i = 0; i < 2; i++) { in test_xchg()
1218 op0 = 0x123456789abcdLL; in test_xchg()
1219 eax = i2l(op0 & 0xffffffff); in test_xchg()
1221 if (i == 0) in test_xchg()
1222 op1 = 0xfbca765423456LL; in test_xchg()
1225 op2 = 0x6532432432434LL; in test_xchg()
1230 : "0" (eax), "1" (edx), "m" (op1), "b" ((int)op2), "c" ((int)(op2 >> 32))); in test_xchg()
1264 res = 0x12345678;\
1265 asm (op " %" size "2, %" size "0\n" \
1266 "movl $0, %1\n"\
1270 : "=r" (res), "=r" (res2) : "m" (mseg), "0" (res));\
1279 asm volatile(op " %" size "3, %" size "0\n"\
1280 "movl $0,%1\n"\
1284 : "=r" (a), "=r" (c) : "0" (a), "r" (b)); \
1303 ldt.limit = (sizeof(seg_data1) + 0xfff) >> 12; in test_segs()
1306 ldt.read_exec_only = 0; in test_segs()
1308 ldt.seg_not_present = 0; in test_segs()
1314 ldt.limit = (sizeof(seg_data2) + 0xfff) >> 12; in test_segs()
1317 ldt.read_exec_only = 0; in test_segs()
1319 ldt.seg_not_present = 0; in test_segs()
1323 modify_ldt(0, &ldt_table, sizeof(ldt_table)); /* read ldt entries */ in test_segs()
1324 #if 0 in test_segs()
1327 for(i=0;i<3;i++) in test_segs()
1332 asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1))); in test_segs()
1334 seg_data1[1] = 0xaa; in test_segs()
1335 seg_data2[1] = 0x55; in test_segs()
1337 asm volatile ("fs movzbl 0x1, %0" : "=r" (res)); in test_segs()
1342 "gs movzbl 0x1, %0\n" in test_segs()
1349 tmp = 0xa5; in test_segs()
1354 "movzbl 0x1, %0\n\t" in test_segs()
1364 segoff.offset = 0xabcdef12; in test_segs()
1365 asm volatile("lfs %2, %0\n\t" in test_segs()
1371 TEST_LR("larw", "w", MK_SEL(2), 0x0100); in test_segs()
1372 TEST_LR("larl", "", MK_SEL(2), 0x0100); in test_segs()
1373 TEST_LR("lslw", "w", MK_SEL(2), 0); in test_segs()
1374 TEST_LR("lsll", "", MK_SEL(2), 0); in test_segs()
1376 TEST_LR("larw", "w", 0xfff8, 0); in test_segs()
1377 TEST_LR("larl", "", 0xfff8, 0); in test_segs()
1378 TEST_LR("lslw", "w", 0xfff8, 0); in test_segs()
1379 TEST_LR("lsll", "", 0xfff8, 0); in test_segs()
1381 TEST_ARPL("arpl", "w", 0x12345678 | 3, 0x762123c | 1); in test_segs()
1382 TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 3); in test_segs()
1383 TEST_ARPL("arpl", "w", 0x12345678 | 1, 0x762123c | 1); in test_segs()
1401 ldt.seg_32bit = 0; in test_code16()
1403 ldt.read_exec_only = 0; in test_code16()
1404 ldt.limit_in_pages = 0; in test_code16()
1405 ldt.seg_not_present = 0; in test_code16()
1413 printf("func1() = 0x%08x\n", res); in test_code16()
1417 printf("func2() = 0x%08x spdec=%d\n", res, res2); in test_code16()
1421 printf("func3() = 0x%08x\n", res); in test_code16()
1428 "movl $0x87654641, %eax\n"
1433 "movl $0x87654321, %eax\n"
1438 "movl $0xabcd4321, %eax\n"
1450 for(i=0;i<256;i++) table[i] = 256 - i; in test_misc()
1451 res = 0x12345678; in test_misc()
1452 asm ("xlat" : "=a" (res) : "b" (table), "0" (res)); in test_misc()
1456 #if 0 in test_misc()
1467 asm volatile ("mov %%cs, %0" : "=r" (cs_sel)); in test_misc()
1510 asm volatile ("push $12345432 ; push $0x9abcdef ; pop (%%rsp) ; pop %0" in test_misc()
1515 asm volatile ("pushl $12345432 ; pushl $0x9abcdef ; popl (%%esp) ; popl %0" in test_misc()
1520 asm volatile ("pushl $12345432 ; pushl $0x9abcdef ; popw (%%esp) ; addl $2, %%esp ; popl %0" in test_misc()
1534 eax = i2l(0x12345678);\
1537 asm volatile ("push $0\n\t"\
1545 : "0" (esi), "1" (edi), "2" (eax), "3" (ecx));\
1564 for(i = 0;i < sizeof(str_buffer); i++) in test_string()
1565 str_buffer[i] = i + 0x56; in test_string()
1593 return (uint8_t *)((seg << 4) + (reg & 0xffff)); in seg_to_linear()
1598 r->esp = (r->esp & ~0xffff) | ((r->esp - 2) & 0xffff); in pushw()
1610 #define VM86_CODE_CS 0x100
1611 #define VM86_CODE_IP 0x100
1620 vm86_mem = mmap((void *)0x00000000, 0x110000, in test_vm86()
1622 MAP_FIXED | MAP_ANON | MAP_PRIVATE, -1, 0); in test_vm86()
1627 memset(&ctx, 0, sizeof(ctx)); in test_vm86()
1632 r->esp = 0xfffe; in test_vm86()
1647 /* mark int 0x21 as being emulated */ in test_vm86()
1648 set_bit((uint8_t *)&ctx.int_revectored, 0x21); in test_vm86()
1658 if (int_num != 0x21) in test_vm86()
1660 ah = (r->eax >> 8) & 0xff; in test_vm86()
1662 case 0x00: /* exit */ in test_vm86()
1664 case 0x02: /* write char */ in test_vm86()
1670 case 0x09: /* write string */ in test_vm86()
1680 r->eax = (r->eax & ~0xff) | '$'; in test_vm86()
1683 case 0xff: /* extension: write eflags number in edx */ in test_vm86()
1686 v &= ~0x3000; in test_vm86()
1692 printf("unsupported int 0x%02x\n", int_num); in test_vm86()
1703 printf("ERROR: unhandled vm86 return code (0x%x)\n", ret); in test_vm86()
1709 munmap(vm86_mem, 0x110000); in test_vm86()
1743 printf(" si_addr=0x%08lx", in sig_handler()
1771 if (setjmp(jmp_env) == 0) { in test_exceptions()
1773 v1 = 0; in test_exceptions()
1779 if (setjmp(jmp_env) == 0) { in test_exceptions()
1781 tab[0] = 1; in test_exceptions()
1783 asm volatile ("bound %0, %1" : : "r" (11), "m" (tab[0])); in test_exceptions()
1789 if (setjmp(jmp_env) == 0) { in test_exceptions()
1791 asm volatile ("movl %0, %%fs" : : "r" ((0x1234 << 3) | 1)); in test_exceptions()
1793 if (setjmp(jmp_env) == 0) { in test_exceptions()
1795 asm volatile ("movl %0, %%fs" : : "r" (3)); in test_exceptions()
1797 asm volatile ("movl %0, %%ss" : : "r" (3)); in test_exceptions()
1804 ldt.limit = (sizeof(seg_data1) + 0xfff) >> 12; in test_exceptions()
1807 ldt.read_exec_only = 0; in test_exceptions()
1813 if (setjmp(jmp_env) == 0) { in test_exceptions()
1815 asm volatile ("movl %0, %%fs" : : "r" (MK_SEL(1))); in test_exceptions()
1822 if (setjmp(jmp_env) == 0) { in test_exceptions()
1827 *(char *)0x1234 = 1; in test_exceptions()
1832 if (setjmp(jmp_env) == 0) { in test_exceptions()
1835 v1 = *(char *)0x1234; in test_exceptions()
1840 if (setjmp(jmp_env) == 0) { in test_exceptions()
1845 if (setjmp(jmp_env) == 0) { in test_exceptions()
1847 asm volatile(".byte 0xf0, 0x90"); in test_exceptions()
1851 if (setjmp(jmp_env) == 0) { in test_exceptions()
1852 asm volatile ("int $0xfd"); in test_exceptions()
1854 if (setjmp(jmp_env) == 0) { in test_exceptions()
1855 asm volatile ("int $0x01"); in test_exceptions()
1857 if (setjmp(jmp_env) == 0) { in test_exceptions()
1858 asm volatile (".byte 0xcd, 0x03"); in test_exceptions()
1860 if (setjmp(jmp_env) == 0) { in test_exceptions()
1861 asm volatile ("int $0x04"); in test_exceptions()
1863 if (setjmp(jmp_env) == 0) { in test_exceptions()
1864 asm volatile ("int $0x05"); in test_exceptions()
1868 if (setjmp(jmp_env) == 0) { in test_exceptions()
1873 if (setjmp(jmp_env) == 0) { in test_exceptions()
1878 if (setjmp(jmp_env) == 0) { in test_exceptions()
1884 if (setjmp(jmp_env) == 0) { in test_exceptions()
1886 asm volatile ("addl $1, %0 ; into" : : "r" (0x7fffffff)); in test_exceptions()
1891 if (setjmp(jmp_env) == 0) { in test_exceptions()
1892 asm volatile ("outb %%al, %%dx" : : "d" (0x4321), "a" (0)); in test_exceptions()
1896 if (setjmp(jmp_env) == 0) { in test_exceptions()
1897 asm volatile ("inb %%dx, %%al" : "=a" (val) : "d" (0x4321)); in test_exceptions()
1901 if (setjmp(jmp_env) == 0) { in test_exceptions()
1902 asm volatile ("rep outsb" : : "d" (0x4321), "S" (tab), "c" (1)); in test_exceptions()
1906 if (setjmp(jmp_env) == 0) { in test_exceptions()
1907 asm volatile ("rep insb" : : "d" (0x4321), "D" (tab), "c" (1)); in test_exceptions()
1911 if (setjmp(jmp_env) == 0) { in test_exceptions()
1916 val = 0; in test_exceptions()
1917 if (setjmp(jmp_env) == 0) { in test_exceptions()
1919 "orl $0x00100, (%%esp)\n" in test_exceptions()
1921 "movl $0xabcd, %0\n" in test_exceptions()
1922 "movl $0x0, %0\n" : "=m" (val) : : "cc", "memory"); in test_exceptions()
1924 printf("val=0x%x\n", val); in test_exceptions()
1944 val = 0; in test_single_step()
1950 "orl $0x00100, (%%esp)\n" in test_single_step()
1952 "movl $0xabcd, %0\n" in test_single_step()
1957 "addl $1, %0\n" in test_single_step()
1964 "movl $0, %%ecx\n" in test_single_step()
1974 "movl $0, %%ecx\n" in test_single_step()
1982 "int $0x80\n" in test_single_step()
1983 "movl $0, %%eax\n" in test_single_step()
1989 "addl $1, %0\n" in test_single_step()
1993 "addl $1, %0\n" in test_single_step()
1998 "addl $1, %0\n" in test_single_step()
2002 "andl $~0x00100, (%%esp)\n" in test_single_step()
2008 for(i = 0; i < 4; i++) in test_single_step()
2014 0xb8, 0x1, 0x00, 0x00, 0x00, /* movl $1, %eax */
2015 0xc3, /* ret */
2042 printf("func1 = 0x%x\n", ((FuncType *)code)()); in test_self_modifying_code()
2045 printf("func%d = 0x%x\n", i, ((FuncType *)code)()); in test_self_modifying_code()
2075 memset(enter_stack, 0, sizeof(enter_stack));\
2100 printf(FMTLX "\n", (long)ptr[0]);\
2107 TEST_ENTER("q", uint64_t, 0); in test_enter()
2112 TEST_ENTER("l", uint32_t, 0); in test_enter()
2118 TEST_ENTER("w", uint16_t, 0); in test_enter()
2127 a = i2l(0x8234a6f8);\
2129 asm volatile(#op : "=a" (r) : "0" (r));\
2136 a = i2l(0x8234a6f8);\
2137 d = i2l(0x8345a1f2);\
2140 asm volatile(#op : "=a" (r), "=d" (rh) : "0" (r), "1" (rh)); \
2160 a = i2l(0x12345678); in test_conv()
2161 asm volatile("bswapl %k0" : "=r" (r) : "0" (a)); in test_conv()
2167 a = i2l(0x12345678); in test_conv()
2168 asm volatile("bswapq %0" : "=r" (r) : "0" (a)); in test_conv()
2215 return 0; in main()