]> xenbits.xensource.com Git - people/andrewcoop/xen-test-framework.git/commitdiff
Misc trivial code cleanup
authorAndrew Cooper <andrew.cooper3@citrix.com>
Fri, 10 May 2019 16:22:15 +0000 (16:22 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Mon, 13 May 2019 11:49:17 +0000 (12:49 +0100)
 * Use named asm parameters for non-trivial blocks
 * "=r" (x) : "r" (x) is more commonly "+r" (x)
 * Correct the header guard in x86-gate.h
 * Remove brackets from absolute memory addresss
 * Use unsigned int rather than unsigned long and forcing back to int with %k
 * Drop unused ex_record_fault_eax reference

Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
arch/x86/include/arch/div.h
arch/x86/include/arch/lib.h
arch/x86/include/arch/x86-gate.h
tests/invlpg/main.c
tests/xsa-123/main.c
tests/xsa-265/main.c

index 8e44898e56303971c37c0f92b220f224e1cff847..725cda08280207dec846839635fda1f22f7b4196 100644 (file)
@@ -40,9 +40,9 @@ static inline uint32_t divmod64(uint64_t *dividend, uint32_t divisor)
                    high /= divisor;
         }
 
-        asm ("divl %2"
-             : "=a" (low), "=d" (mod)
-             : "rm" (divisor), "0" (low), "1" (umod));
+        asm ("divl %[divisor]"
+             : "+a" (low), "=d" (mod)
+             : [divisor] "rm" (divisor), "d" (umod));
 
         *dividend = (((uint64_t)high) << 32) | low;
     }
index 6bd0eb65e591cf6ab72195bd6192b18fc1119aa1..4e62bf9a3d7d4c49772c91aab6c9d7d162feb7c0 100644 (file)
@@ -280,10 +280,10 @@ static inline bool write_cr4_safe(unsigned long cr4)
 {
     exinfo_t fault = 0;
 
-    asm volatile ("1: mov %1, %%cr4; 2:"
+    asm volatile ("1: mov %[cr4], %%cr4; 2:"
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_record_fault_edi)
                   : "+D" (fault)
-                  : "r" (cr4),
+                  : [cr4] "r" (cr4),
                     "X" (ex_record_fault_edi));
 
     return fault;
index 538bab125a0c51d1d2d7d7585012b54169eeeba8..5a410061e8b9d61900ebed6baa4ca5bc6836c7dd 100644 (file)
@@ -114,7 +114,7 @@ static inline void pack_intr_gate(
     pack_gate(g, 14, sel, offset, dpl, other);
 }
 
-#endif /* XTF_X86_TSS_H */
+#endif /* XTF_X86_GATE_H */
 
 /*
  * Local variables:
index 826dc3027f7d730428ed714ad853fc86596feb00..943c7c2110948d18864cd7b9346826fbcb8c7683 100644 (file)
@@ -118,7 +118,7 @@ static unsigned int invlpg_refill(void)
                   "andb $~%c[ad], %[pte1];\n\t" /* Clear A/D bits. */
                   "andb $~%c[ad], %[pte2];\n\t"
                   _ASM_MAYBE_XEN_FEP
-                  "1: invlpg (0x1000); 2:\n\t" /* Invalidate one page only. */
+                  "1: invlpg 0x1000; 2:\n\t"   /* Invalidate one page only. */
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_fail)
                   "mov %[zero], 0x1000;\n\t"   /* Expect refill. */
                   "mov %[zero], 0x2000;\n\t"   /* Expect no refill. */
@@ -141,7 +141,7 @@ static unsigned int invlpg_fs_refill(void)
                   "andb $~%c[ad], %[pte1];\n\t" /* Clear A/D bits. */
                   "andb $~%c[ad], %[pte2];\n\t"
                   _ASM_MAYBE_XEN_FEP
-                  "1: invlpg %%fs:(0x1000); 2:\n\t" /* Invalidate one page only. */
+                  "1: invlpg %%fs:0x1000; 2:\n\t" /* Invalidate one page only. */
                   _ASM_EXTABLE_HANDLER(1b, 2b, ex_fail)
                   "mov %[zero], 0x1000;\n\t"  /* Expect one TLB entry to refil, */
                   "mov %[zero], 0x2000;\n\t"  /* depending on %fs base.*/
@@ -224,7 +224,7 @@ static void test_tlb_refill(void)
 {
     unsigned int i;
 
-    printk("Testing 'invlpg (0x1000)' with segment bases\n");
+    printk("Testing 'invlpg 0x1000' with segment bases\n");
 
     printk("  Test: No segment\n");
     run_tlb_refill_test(invlpg_refill, 1);
index 92e3055af0b9c0a1eda079fc0c76c25b8e98281f..eab70f3d5e0a9886329ed6fdb05c9d97cf51843c 100644 (file)
@@ -35,14 +35,12 @@ bool test_needs_fep = true;
 
 void test_main(void)
 {
-    unsigned long src = 0x1234, dest = 0;
+    unsigned int src = 0x1234, dest = 0;
 
     asm volatile(_ASM_XEN_FEP
                  /* Explicit %cs segment override. */
-                 ".byte 0x2e;"
-                 "mov %k[src], %k[dest]"
-                 : [src] "=r" (src), [dest] "=r" (dest)
-                 : "0" (src), "1" (dest));
+                 ".byte 0x2e; mov %[src], %[dest]"
+                 : [src] "+r" (src), [dest] "+r" (dest));
 
     if ( dest != 0x1234 )
         xtf_failure("  '%%cs:mov %%reg, %%reg' clobbered hypervisor memory\n");
index 760ba49fe3b53e0316989a6b87bf96299d3f52c5..046faefde21409ee8fbb191e2137ad750c832344 100644 (file)
@@ -37,7 +37,7 @@ void test_main(void)
 
     asm volatile ("mov %[ss], %%ss; int3; 1:"
                   _ASM_TRAP_OK(1b)
-                  :: [ss] "m" (ss), "X" (ex_record_fault_eax));
+                  :: [ss] "m" (ss));
 
     /*
      * If Xen is still alive at this point, the erroneous safety check didn't