Commit 288426fe3c50857752ca6e2d24d035a6ecc877d9
1 parent
72cc3881
added LAR/LSL tests
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@152 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
23 additions
and
0 deletions
tests/test-i386.c
@@ -707,6 +707,19 @@ uint8_t seg_data2[4096]; | @@ -707,6 +707,19 @@ uint8_t seg_data2[4096]; | ||
707 | 707 | ||
708 | #define MK_SEL(n) (((n) << 3) | 7) | 708 | #define MK_SEL(n) (((n) << 3) | 7) |
709 | 709 | ||
710 | +#define TEST_LR(op, size, seg, mask)\ | ||
711 | +{\ | ||
712 | + int res, res2;\ | ||
713 | + res = 0x12345678;\ | ||
714 | + asm (op " %" size "2, %" size "0\n" \ | ||
715 | + "movl $0, %1\n"\ | ||
716 | + "jnz 1f\n"\ | ||
717 | + "movl $1, %1\n"\ | ||
718 | + "1:\n"\ | ||
719 | + : "=r" (res), "=r" (res2) : "m" (seg), "0" (res));\ | ||
720 | + printf(op ": Z=%d %08x\n", res2, res & ~(mask));\ | ||
721 | +} | ||
722 | + | ||
710 | /* NOTE: we use Linux modify_ldt syscall */ | 723 | /* NOTE: we use Linux modify_ldt syscall */ |
711 | void test_segs(void) | 724 | void test_segs(void) |
712 | { | 725 | { |
@@ -784,6 +797,16 @@ void test_segs(void) | @@ -784,6 +797,16 @@ void test_segs(void) | ||
784 | : "=r" (res), "=g" (res2) | 797 | : "=r" (res), "=g" (res2) |
785 | : "m" (segoff)); | 798 | : "m" (segoff)); |
786 | printf("FS:reg = %04x:%08x\n", res2, res); | 799 | printf("FS:reg = %04x:%08x\n", res2, res); |
800 | + | ||
801 | + TEST_LR("larw", "w", MK_SEL(2), 0x0100); | ||
802 | + TEST_LR("larl", "", MK_SEL(2), 0x0100); | ||
803 | + TEST_LR("lslw", "w", MK_SEL(2), 0); | ||
804 | + TEST_LR("lsll", "", MK_SEL(2), 0); | ||
805 | + | ||
806 | + TEST_LR("larw", "w", 0xfff8, 0); | ||
807 | + TEST_LR("larl", "", 0xfff8, 0); | ||
808 | + TEST_LR("lslw", "w", 0xfff8, 0); | ||
809 | + TEST_LR("lsll", "", 0xfff8, 0); | ||
787 | } | 810 | } |
788 | 811 | ||
789 | /* 16 bit code test */ | 812 | /* 16 bit code test */ |