Author: afaerber Date: Thu Nov 25 22:53:25 2010 New Revision: 968 URL: http://tracker.coreboot.org/trac/openbios/changeset/968
Log: ppc: Dereference function descriptors on ppc64
In the ppc64 ELF ABI, similar to ia64, a function's symbol does not directly precede its machine instructions. For ppc64 it consists of a triple of entry point, TOC base and environment pointer.
Introduce macros to facilitate handling this. Names suggested by Blue.
Deliberately don't touch the client interface yet, as there's more work to do.
Cc: Alexander Graf agraf@suse.de Cc: Blue Swirl blauwirbel@gmail.com Signed-off-by: Andreas Färber andreas.faerber@web.de
Modified: trunk/openbios-devel/arch/ppc/qemu/start.S trunk/openbios-devel/include/arch/ppc/asmdefs.h
Modified: trunk/openbios-devel/arch/ppc/qemu/start.S ============================================================================== --- trunk/openbios-devel/arch/ppc/qemu/start.S Mon Nov 22 21:00:13 2010 (r967) +++ trunk/openbios-devel/arch/ppc/qemu/start.S Thu Nov 25 22:53:25 2010 (r968) @@ -271,13 +271,13 @@ b 1b
call_dsi_exception: - LOAD_REG_IMMEDIATE(r3, dsi_exception) + LOAD_REG_FUNC(r3, dsi_exception) mtctr r3 bctrl b exception_return
call_isi_exception: - LOAD_REG_IMMEDIATE(r3, isi_exception) + LOAD_REG_FUNC(r3, isi_exception) mtctr r3 bctrl b exception_return @@ -289,7 +289,7 @@ __divide_error: trap_error: mflr r3 - b unexpected_excep + b BRANCH_LABEL(unexpected_excep)
VECTOR( 0x100, "SRE" ): b _entry @@ -445,8 +445,8 @@
/* save memory size in stack */
- bl setup_mmu - bl entry + bl BRANCH_LABEL(setup_mmu) + bl BRANCH_LABEL(entry) 1: nop b 1b
Modified: trunk/openbios-devel/include/arch/ppc/asmdefs.h ============================================================================== --- trunk/openbios-devel/include/arch/ppc/asmdefs.h Mon Nov 22 21:00:13 2010 (r967) +++ trunk/openbios-devel/include/arch/ppc/asmdefs.h Thu Nov 25 22:53:25 2010 (r968) @@ -76,24 +76,37 @@ /************************************************************************/
#ifdef __powerpc64__ + #define LOAD_REG_IMMEDIATE(D, x) \ lis (D), (x)@highest ; \ ori (D), (D), (x)@higher ; \ sldi (D), (D), 32 ; \ oris (D), (D), (x)@h ; \ ori (D), (D), (x)@l + +#define LOAD_REG_FUNC(D, x) \ + LOAD_REG_IMMEDIATE((D), (x)) ; \ + ld (D), 0(D) + #else + #define LOAD_REG_IMMEDIATE(D, x) \ lis (D), HA(x) ; \ addi (D), (D), LO(x) + +#define LOAD_REG_FUNC(D, x) \ + LOAD_REG_IMMEDIATE((D), (x)) + #endif
#ifdef __powerpc64__ #define RFI rfid #define MTMSRD(r) mtmsrd r +#define BRANCH_LABEL(name) . ## name #else #define RFI rfi #define MTMSRD(r) mtmsr r +#define BRANCH_LABEL(name) name #endif
#ifndef __darwin__