public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] MPC85xx u-boot amcro definition
@ 2006-08-28 12:41 enorm
  2006-08-28 13:12 ` Jerry Van Baren
  0 siblings, 1 reply; 2+ messages in thread
From: enorm @ 2006-08-28 12:41 UTC (permalink / raw)
  To: u-boot

Hi,
  Some "naive" questions about u-boot for MPC85xx,  the definition of 
some macro in ppc_asm.tmpl. Can anyone there explain them to me please? 


 1)   In GET_GOT(x) what does  " lwz r0,0b-1b(r14) ;" do? what does 
"0b-1b" stands for, or the meaning of the syntax? why move the content 
of the memory pointing by LR? 


#define GET_GOT                                \ 
>>        bl      1f              ;       \ 
>>        .text   2               ;       \ 
>> 0:     .long   .LCTOC1-1f      ;       \ 
>>        .text                   ;       \ 
>>1:      mflr    r14             ;       \ 
>>        lwz     r0,0b-1b(r14)   ;       \ 
>>        add     r14,r0,r14      ; 

2) In START_GOT,  any special meaning for the value 32768? 
 >> .LCTOC1=.+32768 

3) Syntax for GOT_ENTRY(NAME)  and GOT(NAME),  like    . - .LCTOC1 (line 57) and .text 2 (line 50)
could not find then in the GNU douments (ld, as, gcc, glibc etc). 

Thanks for the help!! 

 
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.denx.de/pipermail/u-boot/attachments/20060828/53d7c8e6/attachment.htm 

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

* [U-Boot-Users] MPC85xx u-boot amcro definition
  2006-08-28 12:41 [U-Boot-Users] MPC85xx u-boot amcro definition enorm
@ 2006-08-28 13:12 ` Jerry Van Baren
  0 siblings, 0 replies; 2+ messages in thread
From: Jerry Van Baren @ 2006-08-28 13:12 UTC (permalink / raw)
  To: u-boot

enorm wrote:
> Hi,
>   Some "naive" questions about u-boot for MPC85xx,  the definition of
> some macro in ppc_asm.tmpl. Can anyone there explain them to me please?
> 
>  1)   In GET_GOT(x) what does  " lwz r0,0b-1b(r14) ;" do? what does
> "0b-1b" stands for, or the meaning of the syntax? why move the content
> of the memory pointing by LR?
> 
> #define GET_GOT                                \
>  >>        bl      1f              ;       \
>  >>        .text   2               ;       \
>  >> 0:     .long   .LCTOC1-1f      ;       \
>  >>        .text                   ;       \
>  >>1:      mflr    r14             ;       \
>  >>        lwz     r0,0b-1b(r14)   ;       \
>  >>        add     r14,r0,r14      ;
> 
> 2) In START_GOT,  any special meaning for the value 32768?
>  >> .LCTOC1=.+32768
> 
> 3) Syntax for GOT_ENTRY(NAME)  and GOT(NAME),  like    . - .LCTOC1 (line 
> 57) and .text 2 (line 50)
> could not find then in the GNU douments (ld, as, gcc, glibc etc).
> 
> Thanks for the help!!

1) 0b and 1b are references to label "0" and "1" in the backwards
direction (this is a way to generate and reference "anonymous" labels.

The mflr r14 is getting the return address, which is the start of this
snippet of code - the "bl 1f" does a "subroutine call" to label 1 in the
forward direction, resulting in the link register containing a pointer
to the label 0 IIRC.  The lwz is picking up a relative pointer to
.LCTOC1 and doing some compensation so that the "add" instruction
results in the correct absolute pointer to the GOT table, regardless of
where the code is actually being executed (speculating towards the end,
there).

gvb

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

end of thread, other threads:[~2006-08-28 13:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-28 12:41 [U-Boot-Users] MPC85xx u-boot amcro definition enorm
2006-08-28 13:12 ` Jerry Van Baren

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