diff options
author | Andreas Färber <andreas.faerber@web.de> | 2010-11-25 21:53:25 +0000 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2010-11-25 21:53:25 +0000 |
commit | 35cfaa83c307b509efd6040dbeed95b1202f9890 (patch) | |
tree | e94cb512ce3e293ab6adee210d9776518d90cd92 | |
parent | 7c7afec1053b7a61da59d7887dcfd1c69aaa7753 (diff) | |
download | openbios-35cfaa83c307b509efd6040dbeed95b1202f9890.zip openbios-35cfaa83c307b509efd6040dbeed95b1202f9890.tar.gz openbios-35cfaa83c307b509efd6040dbeed95b1202f9890.tar.bz2 |
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>
git-svn-id: svn://coreboot.org/openbios/trunk/openbios-devel@968 f158a5a8-5612-0410-a976-696ce0be7e32
-rw-r--r-- | arch/ppc/qemu/start.S | 10 | ||||
-rw-r--r-- | include/arch/ppc/asmdefs.h | 13 |
2 files changed, 18 insertions, 5 deletions
diff --git a/arch/ppc/qemu/start.S b/arch/ppc/qemu/start.S index eef4293..f5c2f24 100644 --- a/arch/ppc/qemu/start.S +++ b/arch/ppc/qemu/start.S @@ -271,13 +271,13 @@ GLOBL(__vectors): 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 @@ exception_return: __divide_error: trap_error: mflr r3 - b unexpected_excep + b BRANCH_LABEL(unexpected_excep) VECTOR( 0x100, "SRE" ): b _entry @@ -445,8 +445,8 @@ GLOBL(_entry): /* save memory size in stack */ - bl setup_mmu - bl entry + bl BRANCH_LABEL(setup_mmu) + bl BRANCH_LABEL(entry) 1: nop b 1b diff --git a/include/arch/ppc/asmdefs.h b/include/arch/ppc/asmdefs.h index 51570ea..9c85ea5 100644 --- a/include/arch/ppc/asmdefs.h +++ b/include/arch/ppc/asmdefs.h @@ -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__ |