[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-changelog] [xen master] x86/setup: correct register clobbers for the asm statement when resyncing the stack



commit 0d3a7bcd0b1181c9dc0fb04ef3abdfcdb5f20441
Author:     Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
AuthorDate: Thu Oct 23 10:18:29 2014 +0200
Commit:     Jan Beulich <jbeulich@xxxxxxxx>
CommitDate: Thu Oct 23 10:18:29 2014 +0200

    x86/setup: correct register clobbers for the asm statement when resyncing 
the stack
    
    When resyncing the stack, the asm statement does not identify %rsi, %rdi and
    %rcx as clobbered by the 'rep movsq'.
    
    Luckily, there are no functional problems in the generated code.  GCC 
decides
    not to save any of them before calling boostrap_map(), which clobbers them.
    
    Correct the clobbers, by listing them as earlyclobber discarded outputs.
    
    Reported-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>
    Signed-off-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx>
    Reviewed-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>
    Tested-by: Daniel Kiper <daniel.kiper@xxxxxxxxxx>
---
 xen/arch/x86/setup.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/xen/arch/x86/setup.c b/xen/arch/x86/setup.c
index bfbb310..73e95c6 100644
--- a/xen/arch/x86/setup.c
+++ b/xen/arch/x86/setup.c
@@ -902,11 +902,13 @@ void __init noreturn __start_xen(unsigned long mbi_p)
                 "movq %%cr4,%%rsi ; "
                 "andb $0x7f,%%sil ; "
                 "movq %%rsi,%%cr4 ; " /* CR4.PGE == 0 */
-                "movq %0,%%cr3    ; " /* CR3 == new pagetables */
+                "movq %[pg],%%cr3 ; " /* CR3 == new pagetables */
                 "orb $0x80,%%sil  ; "
                 "movq %%rsi,%%cr4   " /* CR4.PGE == 1 */
-                : : "r" (__pa(idle_pg_table)), "S" (cpu0_stack),
-                "D" (__va(__pa(cpu0_stack))), "c" (STACK_SIZE / 8) : "memory" 
);
+                : "=&S" (i), "=&D" (i), "=&c" (i) /* All outputs discarded. */
+                :  [pg] "r" (__pa(idle_pg_table)), "0" (cpu0_stack),
+                   "1" (__va(__pa(cpu0_stack))), "2" (STACK_SIZE / 8)
+                : "memory" );
 
             bootstrap_map(NULL);
         }
--
generated by git-patchbot for /home/xen/git/xen.git#master

_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.