[OpenBIOS] [SOLVED] [WIP] ppc: Set up r2, respect function descriptors on ppc64

Blue Swirl blauwirbel at gmail.com
Tue Nov 23 20:52:06 CET 2010


On Tue, Nov 23, 2010 at 8:00 AM, Andreas Färber <andreas.faerber at web.de> wrote:
> Ugly but functional!
> ---
>  arch/ppc/qemu/start.S    |   24 ++++++++++++++++++++++++
>  arch/ppc64/qemu/ldscript |   10 ++++++++++
>  2 files changed, 34 insertions(+), 0 deletions(-)
>
> diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S
> index eef4293..a3b727d 100644
> --- a/arch/ppc/qemu/start.S
> +++ b/arch/ppc/qemu/start.S
> @@ -272,12 +272,18 @@ GLOBL(__vectors):
>
>  call_dsi_exception:
>        LOAD_REG_IMMEDIATE(r3, dsi_exception)
> +#ifdef __powerpc64__
> +       ld r3, 0(r3)
> +#endif

How about LOAD_REG_FUNC macro, which automatically performs the load?

>        mtctr   r3
>        bctrl
>        b       exception_return
>
>  call_isi_exception:
>        LOAD_REG_IMMEDIATE(r3, isi_exception)
> +#ifdef __powerpc64__
> +       ld r3, 0(r3)
> +#endif
>        mtctr   r3
>        bctrl
>        b       exception_return
> @@ -289,7 +295,11 @@ exception_return:
>  __divide_error:
>  trap_error:
>        mflr    r3
> +#ifdef __powerpc64__
> +       b       .unexpected_excep
> +#else
>        b       unexpected_excep
> +#endif

This #ifdeffery could be avoided with a macro to add the dot for ppc64:
        b       BRANCH_LABEL(unexpected_excep)

>
>  VECTOR( 0x100, "SRE" ):
>         b       _entry
> @@ -445,8 +455,22 @@ GLOBL(_entry):
>
>        /* save memory size in stack */
>
> +#ifdef __powerpc64__
> +       LOAD_REG_IMMEDIATE(r2, __toc_start)
> +       addi r2, r2, 0x4000
> +       addi r2, r2, 0x4000
> +#endif
> +
> +#ifdef __powerpc64__
> +       bl .setup_mmu
> +#else
>        bl      setup_mmu
> +#endif
> +#ifdef __powerpc64__
> +       bl .entry
> +#else
>        bl      entry
> +#endif
>  1:     nop
>        b       1b
>
> diff --git a/arch/ppc64/qemu/ldscript b/arch/ppc64/qemu/ldscript
> index 1d8aa8e..28f0b69 100644
> --- a/arch/ppc64/qemu/ldscript
> +++ b/arch/ppc64/qemu/ldscript
> @@ -41,8 +41,18 @@ SECTIONS
>         _data = .;
>         *(.data)
>         *(.data.*)
> +               *(.toc1)
> +               *(.branch_lt)
>        _edata = .;
>     }
> +       .opd : {
> +               *(.opd)
> +       }
> +       .got : {
> +               __toc_start = .;
> +               *(.got)
> +               *(.toc)
> +       }
>
>     .bss ALIGN(4096): {
>         _bss = .;
> --
> 1.7.3
>
>
> --
> OpenBIOS                 http://openbios.org/
> Mailinglist:  http://lists.openbios.org/mailman/listinfo
> Free your System - May the Forth be with you
>



More information about the OpenBIOS mailing list