[U-Boot-Users] Question About how the CPU find the right string address in U-boot binary file ?

Kenneth Johansson kenneth at southpole.se
Thu Jun 5 17:39:02 CEST 2008


On Thu, 2008-06-05 at 20:17 +0800, wang baohua wrote:
> Dear kenneth,
>  Thanks for your quick reply. The first reply is clear.
> The second reply, I cannot calc this string address easily.
> According to your reply "at that address will be a 32 bit address that
> is the address of the string."
>  I search all the U-boot.bin, and CANNOT find any "00 02 B2 80" (that
> is the string "Call backtrace:") using hex search.

hmm where did this number came from?  is it the offset from the start of
the binary file ?? in that case it's obviously not going to be right the
data in the got table is absolute values and depend on where the final
link put the code. 

Lets do this the easy way. take the final u-boot elf file do not use
the .bin file. 

then do "objdump -D u-boot" this will list the data in the .got2
sections as instructions disregard that and look only at the values.



>  Can you give me the detail calc process:
>  1. offset value used in the load, this should be 0xFFEFFFE0 ??
no the offset was in clear text it was -32768 its a decimal number.

>  2. subtract -32768. this should be  - 0x32768 ? or -0x8000 ? or other
> value.
x= offset to load instruction and keep the sign 
x-(-32768) -> offset from start of .got2 section

in this case we have -32768 --32768 ->0 thus the first entry.

>  3. r30 is a pointer to the GOT table, it should be 0xfff34000 at
> 0xfff0358c exec ?? 

it should point +32768 from the start of .got2 section 

>  
> 
> 
> On Thu, Jun 5, 2008 at 5:53 PM, Kenneth Johansson
> <kenneth at southpole.se> wrote:
>         
>         On Thu, 2008-06-05 at 09:50 +0800, wang baohua wrote:
>         > Dear Johansson,
>         >  Thanks for your reply. Your reply is very clear, that's
>         just my
>         > question. In fact, I am study a
>         > MIPS binary file, but I cannot find any resource, so I turn
>         to PowerPC
>         > platform and try to get
>         > clear understand about the string loading process.
>         
>         
>         I'm not sure how similar MIPS is to ppc ABI.
>         
>         > I want to ask according to your reply:
>         > 1. fff0358c: 80 7e 80 00     lwz r3,-32768(r30)
>         >    Is the -32768 stand for  " entry 0 in the .got table" ?
>          Why such a
>         > translate in objdump?
>         
>         
>         It's not objectdump that do this it's the compiler that
>         generate the
>         code like this. r30 is a pointer to the GOT table but the
>         pointer is
>         located so that it's possible to use the full range of the 16
>         bit signed
>         offset. that is if the GOT table only have one entry the r30
>         value would
>         be pointing outside of the table but since it's accessed with
>         a singed
>         offset it will still work.
>         
>         > 2. I found the .got2 section in the U-boot.map, can you tell
>         me how to
>         > calc the right string address (traps.o) ?
>         >    .reloc          0xfff34000     0x1578
>         >    *(.got)
>         >                      0xfff34000                _GOT2_TABLE_
>         = .
>         >   *(.got2)
>         >  .got2          0xfff34000       0x24 cpu/mpc8260/start.o
>         >  .got2          0xfff34024       0x4c
>         cpu/mpc8260/libmpc8260.a(traps.o)
>         
>         
>         ?? I thought this was obvious. to get the entry from the code
>         take the
>         offset value used in the load and subtract -32768 to get the
>         offset into
>         the .got2 section. at that address will be a 32 bit address
>         that is the
>         address of the string.
>         
>         > thanks!
>         
>         
> 





More information about the U-Boot mailing list