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

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

index a9f807a0783e89a073190d0304e6407acd8276aa..d387ddae9d40efc288229e0543f068edadfba967 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-12-17  Vladimir Serbinenko  <phcoder@gmail.com>
+
+       * grub-core/lib/i386/xen/relocator.S: Fix hypercall ABI violation.
+
+       GRUB relied on %ebx being preserved across hypercall which isn't true.
+
 2013-12-17  Vladimir Serbinenko  <phcoder@gmail.com>
 
        * grub-core/lib/x86_64/xen/relocator.S: Fix hypercall ABI violation.
index a1677db9fb40f0336d32c240e54843acd4d5f4bd..694a54c8513c74bf57aff3042fcbf034011c142f 100644 (file)
@@ -38,35 +38,36 @@ VARIABLE(grub_relocator_xen_remapper_map)
 VARIABLE(grub_relocator_xen_remapper_map_high)
        .long   0
 
+       movl    %ebx, %ebp
+
        movl    $2, %esi
        movl    $__HYPERVISOR_update_va_mapping, %eax
        int     $0x82
 
+       movl    %ebp, %ebx
        addl   $(LOCAL(cont) - LOCAL(base)), %ebx
 
        jmp *%ebx
 
 LOCAL(cont):
+       xorl    %eax, %eax
+       movl    %eax, %ebp
+1:
 
-       /* mov imm32, %ecx */
-       .byte   0xb9
-VARIABLE(grub_relocator_xen_paging_size)
+       /* mov imm32, %eax */
+       .byte   0xb8
+VARIABLE(grub_relocator_xen_mfn_list)
        .long   0
+       movl    %eax, %edi
+       movl    %ebp, %eax
+       movl    0(%edi, %eax, 4), %ecx
 
        /* mov imm32, %ebx */
        .byte   0xbb
 VARIABLE(grub_relocator_xen_paging_start)
        .long   0
-
-       /* mov imm32, %eax */
-       .byte   0xb8
-VARIABLE(grub_relocator_xen_mfn_list)
-       .long   0
-
-       movl    %eax, %edi
-1:     
-       movl    %ecx, %ebp
-       movl    0(%edi), %ecx
+       shll    $12, %eax
+       addl    %eax, %ebx
        movl    %ecx, %edx
        shll    $12,  %ecx
        shrl    $20,  %edx
@@ -75,11 +76,14 @@ VARIABLE(grub_relocator_xen_mfn_list)
        movl    $__HYPERVISOR_update_va_mapping, %eax
        int     $0x82
 
-       movl    %ebp, %ecx
-       addl    $4, %edi
-       addl    $4096, %ebx
+       incl    %ebp
+       /* mov imm32, %ecx */
+       .byte   0xb9
+VARIABLE(grub_relocator_xen_paging_size)
+       .long   0
+       cmpl    %ebp, %ecx
 
-       loop 1b
+       ja      1b
 
        /* mov imm32, %ebx */
        .byte   0xbb