public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rabin Vincent <rabin@rab.in>
To: u-boot@lists.denx.de
Subject: [U-Boot] lib_arm global data pointer
Date: Mon, 13 Jul 2009 19:08:46 +0530	[thread overview]
Message-ID: <20090713133846.GA3335@debian> (raw)
In-Reply-To: <5ec3d7930907100552i171e7cb8v590d02bba77deb2@mail.gmail.com>

On Fri, Jul 10, 2009 at 02:52:32PM +0200, Drasko DRASKOVIC wrote:
[...]
> Suppose that I allocated  one register in start.S and put in it some data I
> want to have later on C side. From start.S we enter to start_armboot(void)
> function.
> Would this work :
> 
> void start_armboot (void)
> {
>     init_fnc_t **init_fnc_ptr;
>     char *s;
> #ifndef CFG_NO_FLASH
>     ulong size;
> #endif
> #if defined(CONFIG_VFD) || defined(CONFIG_LCD)
>     unsigned long addr;
> #endif
> *#ifdef DATA_FROM_ASM_IN_R10
>     register volatile unsigned long tmp asm ("r10");
> #endif*
> 
>     /* Pointer is writable since we allocated a register for it */
>     gd = (gd_t*)(_armboot_start - CFG_MALLOC_LEN - sizeof(gd_t));
>     /* compiler optimization barrier needed for GCC >= 3.4 */
>     __asm__ __volatile__("": : :"memory");
> 
>     memset ((void*)gd, 0, sizeof (gd_t));
>     gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
>     memset (gd->bd, 0, sizeof (bd_t));
> 
> *#ifdef DATA_FROM_ASM_IN_R10
>     /* data will be passed to C from assembly start-up in reg r10 */
>     gd->bd->bi_my_data = tmp;
> #endif*
> 
[...]
> 
> Would I from this point on really have on C stack what I had in r10 in
> start.S?
> 
> If not, does anybody have idea how I can do it?

While the above may work, why you don't just follow the procedure call
standard instead?  Place the value in r0 instead of r10, and you'll have
it as the first argument to the function.

Rabin

  reply	other threads:[~2009-07-13 13:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-07-10 12:52 [U-Boot] lib_arm global data pointer Drasko DRASKOVIC
2009-07-13 13:38 ` Rabin Vincent [this message]
2009-07-13 14:00   ` Drasko DRASKOVIC
2009-07-13 15:35     ` Wolfgang Denk
2009-07-13 16:00       ` Drasko DRASKOVIC
2009-07-13 19:34         ` Wolfgang Denk
2009-07-14 13:22           ` Drasko DRASKOVIC

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=20090713133846.GA3335@debian \
    --to=rabin@rab.in \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox