707 |
|
|
708 |
#define MK_SEL(n) (((n) << 3) | 7) |
#define MK_SEL(n) (((n) << 3) | 7) |
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 |
|
|
723 |
/* NOTE: we use Linux modify_ldt syscall */ |
/* NOTE: we use Linux modify_ldt syscall */ |
724 |
void test_segs(void) |
void test_segs(void) |
725 |
{ |
{ |
797 |
: "=r" (res), "=g" (res2) |
: "=r" (res), "=g" (res2) |
798 |
: "m" (segoff)); |
: "m" (segoff)); |
799 |
printf("FS:reg = %04x:%08x\n", res2, res); |
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); |
810 |
} |
} |
811 |
|
|
812 |
/* 16 bit code test */ |
/* 16 bit code test */ |