From 7a6a7d10e6b96ab4a5c0d8852802ec52be2b582e Mon Sep 17 00:00:00 2001 From: Thomas Chou Date: Mon, 16 Aug 2010 10:49:44 +0800 Subject: nios2: fix out of reach case for do_reset There is a limitation (or bug?) of nios2 toolchain. The nios2 gcc didn't generate correct code when the reset vector is passed as a constant. It just generated a direct "call", which was wrong when the reset vector was not located in the same 256MB span as u-boot. The "Nios II Processor Reference Handbook" said, "call can transfer execution anywhere within the 256 MByte range determined by PC31..28. The Nios II GNU linker does not automatically handle cases in which the address is out of this range." So we have to use registered "callr" instruction to do the job. Signed-off-by: Thomas Chou Signed-off-by: Scott McNutt --- arch/nios2/include/asm/system.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'arch/nios2/include') diff --git a/arch/nios2/include/asm/system.h b/arch/nios2/include/asm/system.h index bb03ca5316..086d92bb0c 100644 --- a/arch/nios2/include/asm/system.h +++ b/arch/nios2/include/asm/system.h @@ -56,4 +56,9 @@ ((flags & NIOS2_STATUS_PIE_MSK) == 0x0); \ }) +/* indirect call to go beyond 256MB limitation of toolchain */ +#define nios2_callr(addr) __asm__ __volatile__ ( \ + "callr %0" \ + : : "r" (addr)) + #endif /* __ASM_NIOS2_SYSTEM_H */ -- cgit v1.2.1