[U-Boot] [PATCH] nios2: fix out of reach case for do_reset
Thomas Chou
thomas at wytron.com.tw
Fri Aug 13 05:26:18 CEST 2010
On 08/13/2010 10:52 AM, Mike Frysinger wrote:
> On Thu, Aug 12, 2010 at 10:40 PM, Thomas Chou wrote:
>> 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.
>
> doesnt NIOS have an insn to call indirectly via a register ?
> typically that's how function pointers should be handled when gcc
> generates code.
> -mike
>
>
Hi Mike,
The nios2 does have "callr" instruction to do registered call. But 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
gcc does generate correct "callr" if the reset vector is passed as an
argument. As Altera said, this is a limitation (or bug?) of nios2 toolchain.
So I'd take a similar inline asm approach as we do in linux kernel.
Best regards,
Thomas
More information about the U-Boot
mailing list