From: Andrew Cooper Date: Sun, 16 Feb 2020 23:23:56 +0000 (+0000) Subject: Avoid "q" constraint unless necessary X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=4ef18a178e11c817e9e7fa6c11ea0801ce28a49c;p=people%2Fandrewcoop%2Fxen-test-framework.git Avoid "q" constraint unless necessary Several tests are better off using "r", which permits the use of %esi/%edi/%ebp/%esp in 32bit builds. For the XSA-170 test, jmp indirect doesn't have an immediate encoding, but will happily accept a memory encoding. Signed-off-by: Andrew Cooper --- diff --git a/tests/invlpg/main.c b/tests/invlpg/main.c index b300f95..d929ef3 100644 --- a/tests/invlpg/main.c +++ b/tests/invlpg/main.c @@ -123,7 +123,7 @@ static unsigned int invlpg_refill(void) "mov %[zero], 0x1000;\n\t" /* Expect refill. */ "mov %[zero], 0x2000;\n\t" /* Expect no refill. */ : - : [zero] "q" (0), + : [zero] "r" (0), [ad] "i" (_PAGE_AD), [pte1] "m" (pae_l1_identmap[1]), [pte2] "m" (pae_l1_identmap[2]), @@ -146,7 +146,7 @@ static unsigned int invlpg_fs_refill(void) "mov %[zero], 0x1000;\n\t" /* Expect one TLB entry to refil, */ "mov %[zero], 0x2000;\n\t" /* depending on %fs base.*/ : - : [zero] "q" (0), + : [zero] "r" (0), [ad] "i" (_PAGE_AD), [pte1] "m" (pae_l1_identmap[1]), [pte2] "m" (pae_l1_identmap[2]), diff --git a/tests/xsa-168/main.c b/tests/xsa-168/main.c index add7ce8..f22d38e 100644 --- a/tests/xsa-168/main.c +++ b/tests/xsa-168/main.c @@ -42,7 +42,7 @@ void test_main(void) */ asm volatile ("1: invlpg (%0); 2:" _ASM_EXTABLE(1b, 2b) - :: "q" (0x8000000000000000UL)); + :: "r" (0x8000000000000000UL)); xtf_success(NULL); } diff --git a/tests/xsa-170/main.c b/tests/xsa-170/main.c index 70ee510..d83f5d0 100644 --- a/tests/xsa-170/main.c +++ b/tests/xsa-170/main.c @@ -39,7 +39,7 @@ void wild_jump(void) "1: jmp *%0;" ".Lwild_fixup:" _ASM_EXTABLE(1b, .Lwild_fixup) - :: "qI" (0x8000000000000000ULL)); + :: "rm" (0x8000000000000000ULL)); } void nop_slide(void) @@ -53,7 +53,7 @@ void nop_slide(void) ".Lnop_fixup:" _ASM_EXTABLE(0x0000800000000000, .Lnop_fixup) /* Correct. */ _ASM_EXTABLE(0xffff800000000000, .Lnop_fixup) /* XSA-170. */ - :: "qI" (0x00007ffffffffff8ULL)); + :: "rm" (0x00007ffffffffff8ULL)); } void test_main(void) diff --git a/tests/xsa-183/main.c b/tests/xsa-183/main.c index 605e393..b93cf0e 100644 --- a/tests/xsa-183/main.c +++ b/tests/xsa-183/main.c @@ -58,9 +58,9 @@ void test_main(void) _ASM_EXTABLE(1b, 2b) /* selector to cause a fault. */ "mov %[curr_stk], %%esp;" /* Restore the previous stack. */ - : [curr_stk] "=&q" (curr_stk), + : [curr_stk] "=&r" (curr_stk), [tmp] "=r" (discard) - : [user_stk] "q" (&user_stack[PAGE_SIZE]), + : [user_stk] "r" (&user_stack[PAGE_SIZE]), [AC] "i" (X86_EFLAGS_AC)); /*