* grub-core/lib/x86_64/xen/relocator.S: Fix hypercall ABI violation.

GRUB relied on %rdi being preserved across hypercall which isn't true.
This commit is contained in:
Vladimir Serbinenko 2013-12-17 13:19:58 +01:00
parent 71669c3b76
commit d16ff5897f
2 changed files with 13 additions and 5 deletions

View file

@ -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> 2013-12-17 Vladimir Serbinenko <phcoder@gmail.com>
Implement XEN VFB support. Implement XEN VFB support.

View file

@ -30,6 +30,7 @@ VARIABLE(grub_relocator_xen_remapper_virt)
.quad 0 .quad 0
movq %rax, %rdi movq %rax, %rdi
movq %rax, %rbx
/* mov imm64, %rax */ /* mov imm64, %rax */
.byte 0x48 .byte 0x48
@ -43,9 +44,9 @@ VARIABLE(grub_relocator_xen_remapper_map)
movq $__HYPERVISOR_update_va_mapping, %rax movq $__HYPERVISOR_update_va_mapping, %rax
syscall syscall
addq $(LOCAL(cont) - LOCAL(base)), %rdi addq $(LOCAL(cont) - LOCAL(base)), %rbx
jmp *%rdi jmp *%rbx
LOCAL(cont): LOCAL(cont):
@ -61,7 +62,7 @@ VARIABLE(grub_relocator_xen_paging_size)
VARIABLE(grub_relocator_xen_paging_start) VARIABLE(grub_relocator_xen_paging_start)
.quad 0 .quad 0
movq %rax, %rdi movq %rax, %r12
/* mov imm64, %rax */ /* mov imm64, %rax */
.byte 0x48 .byte 0x48
@ -70,7 +71,8 @@ VARIABLE(grub_relocator_xen_mfn_list)
.quad 0 .quad 0
movq %rax, %rsi movq %rax, %rsi
1: 1:
movq %r12, %rdi
movq %rsi, %rbx movq %rsi, %rbx
movq 0(%rsi), %rsi movq 0(%rsi), %rsi
shlq $12, %rsi shlq $12, %rsi
@ -82,7 +84,7 @@ VARIABLE(grub_relocator_xen_mfn_list)
movq %r9, %rcx movq %r9, %rcx
addq $8, %rbx addq $8, %rbx
addq $4096, %rdi addq $4096, %r12
movq %rbx, %rsi movq %rbx, %rsi
loop 1b loop 1b