From d16ff5897fc32649d8c9b2e64ca13c9f2e79c29c Mon Sep 17 00:00:00 2001 From: Vladimir Serbinenko Date: Tue, 17 Dec 2013 13:19:58 +0100 Subject: [PATCH] * grub-core/lib/x86_64/xen/relocator.S: Fix hypercall ABI violation. GRUB relied on %rdi being preserved across hypercall which isn't true. --- ChangeLog | 6 ++++++ grub-core/lib/x86_64/xen/relocator.S | 12 +++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 89eefba44..a9f807a07 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2013-12-17 Vladimir Serbinenko + + * 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 Implement XEN VFB support. diff --git a/grub-core/lib/x86_64/xen/relocator.S b/grub-core/lib/x86_64/xen/relocator.S index 28ad4c766..78c123350 100644 --- a/grub-core/lib/x86_64/xen/relocator.S +++ b/grub-core/lib/x86_64/xen/relocator.S @@ -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