public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] what means this symbol "@"?
@ 2003-05-08  2:32 seaman
  2003-05-08  4:24 ` Erik Christiansen
       [not found] ` <3EBA0A5A.4080203@bigfoot.com>
  0 siblings, 2 replies; 5+ messages in thread
From: seaman @ 2003-05-08  2:32 UTC (permalink / raw)
  To: u-boot

In u-boot/cpu/mpc8xx/start.S,I usually find this symbol "@",such as
followed:

_start:
 lis r3, CFG_IMMR at h  /* position IMMR */
 mtspr 638, r3
 li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
 b boot_cold

what does it means? Thank you!

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] what means this symbol "@"?
  2003-05-08  2:32 [U-Boot-Users] what means this symbol "@"? seaman
@ 2003-05-08  4:24 ` Erik Christiansen
       [not found] ` <3EBA0A5A.4080203@bigfoot.com>
  1 sibling, 0 replies; 5+ messages in thread
From: Erik Christiansen @ 2003-05-08  4:24 UTC (permalink / raw)
  To: u-boot

On Thu, May 08, 2003 at 11:32:50AM +0900, seaman wrote:
> In u-boot/cpu/mpc8xx/start.S,I usually find this symbol "@",such as
> followed:
> 
> _start:
>  lis r3, CFG_IMMR at h  /* position IMMR */
>  mtspr 638, r3
>  li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
>  b boot_cold
> 
> what does it means? Thank you!

   The motorola assembler info, whether on the website, or in hardcopy
   can be impenetrable. However, knowing from that, what the lis
   instruction does, it can not be hard to deduce what XXXX at h means,
   especially when it is often found in the context:

   lis   r3,XXXXX at h
   ori   r3,XXXXX at l

   To confirm, try assembling and locating (with ld) a few lines, then
   use something like:

   powerpc-linux-objdump -S the_resulting_elf_file > /tmp/dump

   and examine what part of the address goes where.

Regards,
Erik

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] what means this symbol "@"?
       [not found] ` <3EBA0A5A.4080203@bigfoot.com>
@ 2003-05-08  7:09   ` seaman
  0 siblings, 0 replies; 5+ messages in thread
From: seaman @ 2003-05-08  7:09 UTC (permalink / raw)
  To: u-boot

Thank you!Now I understand it.
lis r1,value =addis r1,0,value

----- Original Message -----
From: "Udi Finkelstein" <udif@bigfoot.com>
To: "seaman" <okisoftxman@hotmail.com>
Sent: Thursday, May 08, 2003 4:42 PM
Subject: Re: [U-Boot-Users] what means this symbol "@"?


> My guess is that "@h" means a 16-bit constant made of the upper 16-bot
> of CFG_IMMR.
>
> It took me a lot of time to find what "lis" is. I couldn't find it in
> either the IBM arch. manual I had, or the MPC823 manual.
> Only after I looked at the obcode, I found that this is actually
> something like a private case of the add immediate instruction or
> something like that, where the 1st argument is a constant 0.
> This means that lis loads a register by taking a 16-bit constant and
> putting it in the upper 16-bit, and resetting the lower 16-bit (because
> that's 0 + arg<<16).
> Since CFG_IMMR is on a 64KB boundary, its lower 16 bitare zero, so "lis
> r3,CFG_IMMR at h" simply loads CFG_IMMR to r3.
>
> Udi
>
> seaman wrote:
> > In u-boot/cpu/mpc8xx/start.S,I usually find this symbol "@",such as
> > followed:
> >
> > _start:
> >  lis r3, CFG_IMMR at h  /* position IMMR */
> >  mtspr 638, r3
> >  li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
> >  b boot_cold
> >
> > what does it means? Thank you!
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > -------------------------------------------------------
> > Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
> > The only event dedicated to issues related to Linux enterprise solutions
> > www.enterpriselinuxforum.com
> >
> > _______________________________________________
> > U-Boot-Users mailing list
> > U-Boot-Users at lists.sourceforge.net
> > https://lists.sourceforge.net/lists/listinfo/u-boot-users
> >
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] what means this symbol "@"?
       [not found] <00039882.C22236@hotmail.com>
@ 2003-05-08 11:22 ` Jerry Van Baren
  2003-05-08 12:26   ` Pantelis Antoniou
  0 siblings, 1 reply; 5+ messages in thread
From: Jerry Van Baren @ 2003-05-08 11:22 UTC (permalink / raw)
  To: u-boot

@h  = high order 16 bits
@l  = low order 16 bits
@ha = high order 16 bits adjusted so that, when you add the sign-extended 
low order 16 bits, the value comes out to the right number

Example of @ha:
   lis  r3,     0x0000FFFF at ha    /* r3 = 0x0001oooo */
   addi r3, r3, 0x0000FFFF at l     /* r3 = 0x0001oooo + 0xffffFFFF = 
0x0000FFFF */

will actually load 0x00010000 into r3 in the first instruction because the 
second instruction (addi) sign-extends the 0x0000FFFF to become 
0xFFFFFFFF.  After the addi, r3 will have the proper value 0x0000FFFF.

ori does not sign extend the immediate value, so it does not have this 
quirk and therefore you would use @h and @l:
   lis r3,     0x0000FFFF at h      /* r3 = 0x00000000 */
   ori r3, r3, 0x0000FFFF at l      /* r3 = 0x0000oooo | 0xooooFFFF = 
0x0000FFFF */

I've never figured out why someone would want to use addi instead of ori in 
the second instruction of the load sequence.

gvb


At 11:32 AM 5/8/2003 -0400, okisoftxman at hotmail.com wrote:
>In u-boot/cpu/mpc8xx/start.S,I usually find this symbol "@",such as
>followed:
>
>_start:
>  lis r3, CFG_IMMR at h  /* position IMMR */
>  mtspr 638, r3
>  li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
>  b boot_cold
>
>what does it means? Thank you!



**********************************************************************
This e-mail and any files transmitted with it may be confidential and
may be legally privileged or otherwise exempt from disclosure under
applicable law. This e-mail and its files are intended solely for
the individual or entity to whom they are addressed and their content
is the property of Smiths Aerospace.  If you are not the intended
recipient, please do not read, copy, use or disclose this communication.
If you have received this e-mail in error please notify the e-mail 
administrator at postmaster at smiths-aerospace.com and then delete this 
e-mail, its files and any copies.

This footnote also confirms that this e-mail message has been scanned
for the presence of known computer viruses.

Smiths addresses are changing!  The new addresses are of the form
firstname.lastname at smiths-aerospace.com.  Please update your address
books!  Please begin using the new form immediately.
***********************************************************************

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot-Users] what means this symbol "@"?
  2003-05-08 11:22 ` Jerry Van Baren
@ 2003-05-08 12:26   ` Pantelis Antoniou
  0 siblings, 0 replies; 5+ messages in thread
From: Pantelis Antoniou @ 2003-05-08 12:26 UTC (permalink / raw)
  To: u-boot

Jerry Van Baren wrote:

> @h  = high order 16 bits
> @l  = low order 16 bits
> @ha = high order 16 bits adjusted so that, when you add the 
> sign-extended low order 16 bits, the value comes out to the right number
>
> Example of @ha:
>   lis  r3,     0x0000FFFF at ha    /* r3 = 0x0001oooo */
>   addi r3, r3, 0x0000FFFF at l     /* r3 = 0x0001oooo + 0xffffFFFF = 
> 0x0000FFFF */
>
> will actually load 0x00010000 into r3 in the first instruction because 
> the second instruction (addi) sign-extends the 0x0000FFFF to become 
> 0xFFFFFFFF.  After the addi, r3 will have the proper value 0x0000FFFF.
>
> ori does not sign extend the immediate value, so it does not have this 
> quirk and therefore you would use @h and @l:
>   lis r3,     0x0000FFFF at h      /* r3 = 0x00000000 */
>   ori r3, r3, 0x0000FFFF at l      /* r3 = 0x0000oooo | 0xooooFFFF = 
> 0x0000FFFF */
>
> I've never figured out why someone would want to use addi instead of 
> ori in the second instruction of the load sequence.
>
> gvb 

  It's useful when the second instruction is a load, or a store.

Instead of doing this to store a value to the global variable foo:

   lis  r3,foo at h
   ori  r3,r3,foo at l
   stw  r4,0(r3)       ; store r4 to foo

do this:
  
   lis  r3,foo at ha
   stw  r4,foo at l(r3)   ; store r4 to foo

that is because the store and load immediate offsets are sign extended.

Regards

Pantelis

>
>
> At 11:32 AM 5/8/2003 -0400, okisoftxman at hotmail.com wrote:
>
>> In u-boot/cpu/mpc8xx/start.S,I usually find this symbol "@",such as
>> followed:
>>
>> _start:
>>  lis r3, CFG_IMMR at h  /* position IMMR */
>>  mtspr 638, r3
>>  li r21, BOOTFLAG_COLD /* Normal Power-On: Boot from FLASH */
>>  b boot_cold
>>
>> what does it means? Thank you!
>
>
>
>
> **********************************************************************
> This e-mail and any files transmitted with it may be confidential and
> may be legally privileged or otherwise exempt from disclosure under
> applicable law. This e-mail and its files are intended solely for
> the individual or entity to whom they are addressed and their content
> is the property of Smiths Aerospace.  If you are not the intended
> recipient, please do not read, copy, use or disclose this communication.
> If you have received this e-mail in error please notify the e-mail 
> administrator at postmaster at smiths-aerospace.com and then delete this 
> e-mail, its files and any copies.
>
> This footnote also confirms that this e-mail message has been scanned
> for the presence of known computer viruses.
>
> Smiths addresses are changing!  The new addresses are of the form
> firstname.lastname at smiths-aerospace.com.  Please update your address
> books!  Please begin using the new form immediately.
> ***********************************************************************
>
>
> -------------------------------------------------------
> Enterprise Linux Forum Conference & Expo, June 4-6, 2003, Santa Clara
> The only event dedicated to issues related to Linux enterprise solutions
> www.enterpriselinuxforum.com
>
> _______________________________________________
> U-Boot-Users mailing list
> U-Boot-Users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/u-boot-users
>
>

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-05-08 12:26 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-05-08  2:32 [U-Boot-Users] what means this symbol "@"? seaman
2003-05-08  4:24 ` Erik Christiansen
     [not found] ` <3EBA0A5A.4080203@bigfoot.com>
2003-05-08  7:09   ` seaman
     [not found] <00039882.C22236@hotmail.com>
2003-05-08 11:22 ` Jerry Van Baren
2003-05-08 12:26   ` Pantelis Antoniou

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox