[OpenBIOS] [PATCH v2] Introduce forth_init() for trampoline initialization

Blue Swirl blauwirbel at gmail.com
Sat Nov 13 12:35:42 CET 2010


On Sat, Nov 13, 2010 at 11:09 AM, Andreas Färber <andreas.faerber at web.de> wrote:
> Use init_trampoline() for trampoline variable initialization.
>
> Add calls to a new forth_init() function for each architecture
> to invoke it. Idea courtesy of Blue.
>
> This fixes ppc64 compilation by avoiding a casted self-reference.
>
> v2:
> * Share init_trampoline() with kernel/bootstrap.c, suggested by Mark.
> * Adopt QEMU coding style for new functions.
>
> Cc: Blue Swirl <blauwirbel at gmail.com>
> Cc: Mark Cave-Ayland <mark.cave-ayland at siriusit.co.uk>
> Signed-off-by: Andreas Färber <andreas.faerber at web.de>

Acked-by: Blue Swirl <blauwirbel at gmail.com>

> ---
>  arch/amd64/openbios.c   |    1 +
>  arch/ppc/kernel.c       |    1 +
>  arch/ppc/qemu/kernel.c  |    1 +
>  arch/sparc32/openbios.c |    1 +
>  arch/sparc64/openbios.c |    1 +
>  arch/unix/unix.c        |    1 +
>  arch/x86/openbios.c     |    1 +
>  include/kernel/kernel.h |    2 ++
>  kernel/bootstrap.c      |   21 ++++++---------------
>  kernel/internal.c       |   16 +++++++++++++++-
>  10 files changed, 30 insertions(+), 16 deletions(-)
>
> diff --git a/arch/amd64/openbios.c b/arch/amd64/openbios.c
> index df43943..db138ad 100644
> --- a/arch/amd64/openbios.c
> +++ b/arch/amd64/openbios.c
> @@ -67,6 +67,7 @@ int openbios(void)
>
>        load_dictionary((char *)sys_info.dict_start,
>                        sys_info.dict_end-sys_info.dict_start);
> +       forth_init();
>
>        relocate(&sys_info);
>
> diff --git a/arch/ppc/kernel.c b/arch/ppc/kernel.c
> index 57efde7..28f2965 100644
> --- a/arch/ppc/kernel.c
> +++ b/arch/ppc/kernel.c
> @@ -83,6 +83,7 @@ initialize_forth( void )
>  {
>        dict = malloc(DICTIONARY_SIZE);
>        load_dictionary( forth_dictionary, sizeof(forth_dictionary) );
> +       forth_init();
>
>        PUSH_xt( bind_noname_func(arch_of_init) );
>        fword("PREPOST-initializer");
> diff --git a/arch/ppc/qemu/kernel.c b/arch/ppc/qemu/kernel.c
> index dbfca57..4cae525 100644
> --- a/arch/ppc/qemu/kernel.c
> +++ b/arch/ppc/qemu/kernel.c
> @@ -86,6 +86,7 @@ initialize_forth( void )
>        dictlimit = DICTIONARY_SIZE;
>
>        load_dictionary( forth_dictionary, sizeof(forth_dictionary) );
> +       forth_init();
>
>        PUSH_xt( bind_noname_func(arch_of_init) );
>        fword("PREPOST-initializer");
> diff --git a/arch/sparc32/openbios.c b/arch/sparc32/openbios.c
> index e368d6c..1c86752 100644
> --- a/arch/sparc32/openbios.c
> +++ b/arch/sparc32/openbios.c
> @@ -970,6 +970,7 @@ int openbios(void)
>        load_dictionary((char *)sys_info.dict_start,
>                        (unsigned long)sys_info.dict_end
>                         - (unsigned long)sys_info.dict_start);
> +       forth_init();
>
>  #ifdef CONFIG_DEBUG_BOOT
>        printk("forth started.\n");
> diff --git a/arch/sparc64/openbios.c b/arch/sparc64/openbios.c
> index 49bbe27..8c08814 100644
> --- a/arch/sparc64/openbios.c
> +++ b/arch/sparc64/openbios.c
> @@ -623,6 +623,7 @@ int openbios(void)
>        load_dictionary((char *)sys_info.dict_start,
>                        (unsigned long)sys_info.dict_end
>                         - (unsigned long)sys_info.dict_start);
> +       forth_init();
>
>  #ifdef CONFIG_DEBUG_BOOT
>        printk("forth started.\n");
> diff --git a/arch/unix/unix.c b/arch/unix/unix.c
> index a8b9f78..e5c4590 100644
> --- a/arch/unix/unix.c
> +++ b/arch/unix/unix.c
> @@ -514,6 +514,7 @@ int main(int argc, char *argv[])
>             printk("done.\n");
>
>        read_dictionary(argv[optind]);
> +       forth_init();
>
>        PUSH_xt( bind_noname_func(arch_init) );
>        fword("PREPOST-initializer");
> diff --git a/arch/x86/openbios.c b/arch/x86/openbios.c
> index 62ef587..24b886d 100644
> --- a/arch/x86/openbios.c
> +++ b/arch/x86/openbios.c
> @@ -90,6 +90,7 @@ int openbios(void)
>        load_dictionary((char *)sys_info.dict_start,
>                        (unsigned long)sys_info.dict_end -
>                        (unsigned long)sys_info.dict_start);
> +       forth_init();
>
>        relocate(&sys_info);
>
> diff --git a/include/kernel/kernel.h b/include/kernel/kernel.h
> index 15605b5..c887e24 100644
> --- a/include/kernel/kernel.h
> +++ b/include/kernel/kernel.h
> @@ -32,6 +32,8 @@ extern void           panic(const char *error) __attribute__ ((noreturn));
>
>  extern xt_t            findword(const char *s1);
>  extern void            modules_init( void );
> +extern void            init_trampoline(ucell *t);
> +extern void            forth_init(void);

'extern' is useless qualifier for function declarations. It's used a
lot here, though.



More information about the OpenBIOS mailing list