]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
* grub-core/lib/x86_64/xen/relocator.S: Fix hypercall ABI violation.
authorVladimir Serbinenko <phcoder@gmail.com>
Tue, 17 Dec 2013 12:19:58 +0000 (13:19 +0100)
committerVladimir Serbinenko <phcoder@gmail.com>
Tue, 17 Dec 2013 12:19:58 +0000 (13:19 +0100)
GRUB relied on %rdi being preserved across hypercall which isn't true.

ChangeLog
grub-core/lib/x86_64/xen/relocator.S

index 89eefba44aad91ee81433550b6e20b5785bf58c9..a9f807a0783e89a073190d0304e6407acd8276aa 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-12-17  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/lib/x86_64/xen/relocator.S: Fix hypercall ABI violation.
+
+       GRUB relied on %rdi being preserved across hypercall which isn't true.
+
 2013-12-17  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Implement XEN VFB support.
index 28ad4c76664be2bfd1066fc3271c4d0209e78b37..78c1233508c91f4809e4fc9ceb1c12beac0a292a 100644 (file)
@@ -30,6 +30,7 @@ VARIABLE(grub_relocator_xen_remapper_virt)
        .quad   0
 
        movq    %rax, %rdi
+       movq    %rax, %rbx
 
        /* mov imm64, %rax */
        .byte   0x48
@@ -43,9 +44,9 @@ VARIABLE(grub_relocator_xen_remapper_map)
        movq    $__HYPERVISOR_update_va_mapping, %rax
        syscall
 
-       addq   $(LOCAL(cont) - LOCAL(base)), %rdi
+       addq   $(LOCAL(cont) - LOCAL(base)), %rbx
 
-       jmp *%rdi
+       jmp *%rbx
 
 LOCAL(cont):
        
@@ -61,7 +62,7 @@ VARIABLE(grub_relocator_xen_paging_size)
 VARIABLE(grub_relocator_xen_paging_start)
        .quad   0
 
-       movq    %rax, %rdi
+       movq    %rax, %r12
 
        /* mov imm64, %rax */
        .byte   0x48
@@ -70,7 +71,8 @@ VARIABLE(grub_relocator_xen_mfn_list)
        .quad   0
 
        movq    %rax, %rsi
-1:     
+1:
+       movq    %r12, %rdi
        movq    %rsi, %rbx
        movq    0(%rsi), %rsi
        shlq    $12,  %rsi
@@ -82,7 +84,7 @@ VARIABLE(grub_relocator_xen_mfn_list)
 
        movq    %r9, %rcx
        addq    $8, %rbx
-       addq    $4096, %rdi
+       addq    $4096, %r12
        movq    %rbx, %rsi
 
        loop 1b