]> git.ipfire.org Git - thirdparty/grub.git/commitdiff
Zero %ebp and %edi when entering Linux's 32-bit entry point, as
authorColin Watson <cjwatson@ubuntu.com>
Thu, 2 Sep 2010 21:36:09 +0000 (22:36 +0100)
committerColin Watson <cjwatson@ubuntu.com>
Thu, 2 Sep 2010 21:36:09 +0000 (22:36 +0100)
required by the boot protocol.
* include/grub/i386/relocator.h (struct grub_relocator32_state): Add
ebp and edi members.
* grub-core/lib/i386/relocator.c (grub_relocator_boot): Handle
state.ebp and state.edi.
* grub-core/lib/i386/relocator32.S (grub_relocator32_start): Set
%ebp and %edi according to grub_relocator32_ebp and
grub_relocator32_edi respectively.
* grub-core/loader/i386/linux.c (grub_linux_boot): Zero state.ebp
and state.edi.

ChangeLog
grub-core/lib/i386/relocator.c
grub-core/lib/i386/relocator32.S
grub-core/loader/i386/linux.c
include/grub/i386/relocator.h

index 4b1ccafd33314bcd90dd6cf96464fdace73a616b..a12035634e405d8206f6527fb9af7f1479ff6efd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-02  Colin Watson  <cjwatson@ubuntu.com>
+
+       Zero %ebp and %edi when entering Linux's 32-bit entry point, as
+       required by the boot protocol.
+
+       * include/grub/i386/relocator.h (struct grub_relocator32_state): Add
+       ebp and edi members.
+       * grub-core/lib/i386/relocator.c (grub_relocator_boot): Handle
+       state.ebp and state.edi.
+       * grub-core/lib/i386/relocator32.S (grub_relocator32_start): Set
+       %ebp and %edi according to grub_relocator32_ebp and
+       grub_relocator32_edi respectively.
+       * grub-core/loader/i386/linux.c (grub_linux_boot): Zero state.ebp
+       and state.edi.
+
 2010-09-02  Vladimir Serbinenko  <phcoder@gmail.com>
 
        Add i386-pc-pxe image target.
index f06a6ef86d21d7198abe5b192d69a655e13d782e..1bc4240c360a0b1f2dff50af8ebcfb75442dd0bc 100644 (file)
@@ -59,7 +59,9 @@ extern grub_uint32_t grub_relocator32_ecx;
 extern grub_uint32_t grub_relocator32_edx;
 extern grub_uint32_t grub_relocator32_eip;
 extern grub_uint32_t grub_relocator32_esp;
+extern grub_uint32_t grub_relocator32_ebp;
 extern grub_uint32_t grub_relocator32_esi;
+extern grub_uint32_t grub_relocator32_edi;
 
 extern grub_uint8_t grub_relocator64_start;
 extern grub_uint8_t grub_relocator64_end;
@@ -165,7 +167,9 @@ grub_relocator32_boot (struct grub_relocator *rel,
   grub_relocator32_edx = state.edx;
   grub_relocator32_eip = state.eip;
   grub_relocator32_esp = state.esp;
+  grub_relocator32_ebp = state.ebp;
   grub_relocator32_esi = state.esi;
+  grub_relocator32_edi = state.edi;
 
   grub_memmove (get_virtual_current_address (ch), &grub_relocator32_start,
                RELOCATOR_SIZEOF (32));
index b581305a5a025204758c713a276c2856365431cd..09ce56ad0ae60d0749a1ab93de0fc3ee36d695d0 100644 (file)
@@ -65,13 +65,27 @@ VARIABLE(grub_relocator32_esp)
 
        movl    %eax, %esp
 
+       /* mov imm32, %eax */
+       .byte   0xb8
+VARIABLE(grub_relocator32_ebp)
+       .long   0
+
+       movl    %eax, %ebp
+
        /* mov imm32, %eax */
        .byte   0xb8
 VARIABLE(grub_relocator32_esi)
        .long   0
 
        movl    %eax, %esi
-       
+
+       /* mov imm32, %eax */
+       .byte   0xb8
+VARIABLE(grub_relocator32_edi)
+       .long   0
+
+       movl    %eax, %edi
+
        /* mov imm32, %eax */
        .byte   0xb8
 VARIABLE(grub_relocator32_eax)
index debcdb71fb4c9210865b96ff81288a16309fcc9a..9cb26a0c261a22e128451e3c95b93c90d55411c0 100644 (file)
@@ -716,7 +716,7 @@ grub_linux_boot (void)
 
   /* FIXME.  */
   /*  asm volatile ("lidt %0" : : "m" (idt_desc)); */
-  state.ebx = 0;
+  state.ebp = state.edi = state.ebx = 0;
   state.esi = real_mode_target;
   state.esp = real_mode_target;
   state.eip = params->code32_start;
index 891235f9b7e667ef1f559fab7d5d036d0e6a8bd3..6ff5c66319ca65ced025d0f97e8ffe392dca3cd6 100644 (file)
 struct grub_relocator32_state
 {
   grub_uint32_t esp;
+  grub_uint32_t ebp;
   grub_uint32_t eax;
   grub_uint32_t ebx;
   grub_uint32_t ecx;
   grub_uint32_t edx;
   grub_uint32_t eip;
   grub_uint32_t esi;
+  grub_uint32_t edi;
 };
 
 struct grub_relocator16_state