MPC8xx u-boot amcro definition - Embedded

This is a discussion on MPC8xx u-boot amcro definition - Embedded ; Hi, We are just moving to the linux and gnu world from other RTOS. First thing we try to port our own bootloader to U-boot for our MPC8xx board. Some "naive" questions about u-boot for MPC8xx, the definition of some ...

+ Reply to Thread
Results 1 to 4 of 4

Thread: MPC8xx u-boot amcro definition

  1. MPC8xx u-boot amcro definition

    Hi,

    We are just moving to the linux and gnu world from other RTOS. First
    thing we try to port our own bootloader to U-boot for our MPC8xx board.


    Some "naive" questions about u-boot for MPC8xx, 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 .L_ ## (NAME) ...
    could not find then in the GNU douments (ld, as, gcc, glibc etc).


    Thanks for the helps!!


  2. Re: MPC8xx u-boot amcro definition

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


    I'm not fluent in 8xx ASM, but I _think_ 0b-1b just means -1 as an
    unsigned value, thus a value of the appropriate size with all bits set
    (supposing the 8xx uses normal integer representation. I do think
    -1(r14) should do the same.

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


    No idea.

    >
    > 3) Syntax for GOT_ENTRY(NAME) and GOT(NAME), like .L_ ## (NAME) ...
    > could not find then in the GNU douments (ld, as, gcc, glibc etc).
    >
    >


    ## is as preprocessor directive that joining two strings. So if NAME is
    set to xyz , L_ ## (NAME) will be the string L_xyz.

    -Michael

  3. Re: MPC8xx u-boot amcro definition

    Michael Schnell wrote:

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



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


    > I'm not fluent in 8xx ASM, but I _think_ 0b-1b just means -1 as an
    > unsigned value, thus a value of the appropriate size with all bits set
    > (supposing the 8xx uses normal integer representation. I do think
    > -1(r14) should do the same.


    The expressions 0b and 1b refer to the local labels
    0: and 1: back. The expression is negative of the
    distance between the labels 0: and 1:.

    For details, see the GNU as manual, local labels.

    --

    Tauno Voipio
    tauno voipio (at) iki fi

  4. Re: MPC8xx u-boot amcro definition

    > The expressions 0b and 1b refer to the local labels
    > 0: and 1: back.


    Right you are !

    Silly me .

+ Reply to Thread