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 --- arch/ppc/qemu/start.S | 10 +++++----- 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__