[coreboot] libpayload: payload exec code (repost)

Uwe Hermann uwe at hermann-uwe.de
Tue May 20 20:00:42 CEST 2008


On Tue, May 20, 2008 at 10:46:15AM -0600, Jordan Crouse wrote:
> Here is a repost of the payload execute code for libpayload.
> The API is described here:
> http://www.coreboot.org/Payload_API
> 
> Jordan

> libpayload:  Add an exec() and i386_do_exec() function
> 
> Add functions for libpayload to execute other payloads in memory,
> and have those functions return cleanly.
> 
> Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>

Acked-by: Uwe Hermann <uwe at hermann-uwe.de>

but see below for nitpicking...


> Index: libpayload/i386/Makefile.inc
> ===================================================================
> --- libpayload.orig/i386/Makefile.inc	2008-05-14 14:07:09.000000000 -0600
> +++ libpayload/i386/Makefile.inc	2008-05-14 14:11:29.000000000 -0600
> @@ -29,3 +29,4 @@
>  
>  TARGETS-y += i386/head.o i386/main.o i386/sysinfo.o
>  TARGETS-y += i386/timer.o i386/coreboot.o i386/util.o
> +TARGETS-y += i386/exec.o
> Index: libpayload/i386/exec.S
> ===================================================================
> --- /dev/null	1970-01-01 00:00:00.000000000 +0000
> +++ libpayload/i386/exec.S	2008-05-20 10:32:54.000000000 -0600
> @@ -0,0 +1,97 @@
[...]
> +/* calling syntax:  i386_do_exec(long addr, int argc, char **argv, int *ret) */
> +
> +/* This implements the payload API detailed here:
> +   http://www.coreboot.org/Payload_API
> +*/

Use kernel-style commenting, please:

/*
 * This implements the payload API detailed here:
 * http://www.coreboot.org/Payload_API
 */


> +
> +.align 4
> +.text
> +
> +.global i386_do_exec
> +        .type i386_do_exec, at function
> +
> +i386_do_exec:
> +	pushl %ebp
> +        movl %esp, %ebp
> +	pushl %eax

Whitespace inconsistency.


> +
> +	# Put the run address in %eax

Wouldn't C-style /* */ comments also work? I think we use those
in some other asm code, let's keep them consistent.


> +/**
> + * Execute code in memory
> + *
> + * @param ptr The entry point to jump to
> + * @return Return the return value from the entry point
> + */
> +
> +
> +int exec(long addr, int argc, char **argv)

No empty lines between doxygen-comment and function needed, drop.


Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org




More information about the coreboot mailing list