[U-Boot-Users] what means this symbol "@"?

Pantelis Antoniou panto at intracom.gr
Thu May 8 14:26:24 CEST 2003


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
>
>






More information about the U-Boot mailing list