Don't do a call as the first instruction in libpayload.
authorMarc Jones <marcj303@gmail.com>
Thu, 6 Oct 2011 22:38:35 +0000 (16:38 -0600)
committerMarc Jones <marcj303@gmail.com>
Tue, 11 Oct 2011 09:47:06 +0000 (11:47 +0200)
Doing a call before the payload has set up its stack is risky. The stack may
not be in a favorable location. Normally this is not an issue with coreboot
or other well behaved callers.

Change-Id: Ie6f6748a471324b29ebad045c807dfc9f4b92034
Signed-off-by: Marc Jones <marcj303@gmail.com>
Reviewed-on: http://review.coreboot.org/240
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
payloads/libpayload/arch/i386/head.S

index 88db4124d5627cca620419a8da4e16df44788cde..3dd61336f91013b7e8613b7cc0f79c634ea95db8 100644 (file)
  * change anything.
  */
 _entry:
  * change anything.
  */
 _entry:
-       call _init
-
-       /* We're back - go back to the bootloader. */
-       ret
+       jmp _init
 
        .align 4
 
 
        .align 4
 
@@ -66,6 +63,9 @@ _init:
        /* No interrupts, please. */
        cli
 
        /* No interrupts, please. */
        cli
 
+       /* There is a bunch of stuff missing here to take arguments on the stack
+        * See http://www.coreboot.org/Payload_API and exec.S.
+        */
        /* Store current stack pointer. */
        movl %esp, %esi
 
        /* Store current stack pointer. */
        movl %esp, %esi