All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Chou <thomas@wytron.com.tw>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] nios2: fix out of reach case for do_reset
Date: Fri, 13 Aug 2010 11:26:18 +0800	[thread overview]
Message-ID: <4C64BB5A.8090404@wytron.com.tw> (raw)
In-Reply-To: <AANLkTimW2C+uKT=yZLCwutCH4xzKRHa3sLjVwi_nfxfc@mail.gmail.com>

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

  reply	other threads:[~2010-08-13  3:26 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-13  2:40 [U-Boot] [PATCH] nios2: fix out of reach case for do_reset Thomas Chou
2010-08-13  2:52 ` Mike Frysinger
2010-08-13  3:26   ` Thomas Chou [this message]
2010-08-13 23:51 ` [U-Boot] UNS: [Nios2-dev] " Brad Parker
2010-08-16  2:48   ` Thomas Chou
2010-08-16  2:49   ` [U-Boot] [PATCH v2] " Thomas Chou
2010-08-20  2:25     ` Scott McNutt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4C64BB5A.8090404@wytron.com.tw \
    --to=thomas@wytron.com.tw \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.