Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

06 - Chainloader: understanding core concepts#152

Discussion options

Hey,

I have been following along the tutorial and reached the 6th chapter. I am having trouble understanding a few concepts and the assembly in boot.s.
This is me after half a day of googling - could you please share some resources / explanations about:

  • what is a "link address"? I know the rpi loads the kernel to 0x8000 (as specified in thelink.ld file), but why do we need to specify the "link address" in the linker file and not just copy wherever we want?
  • relative/absolute addressing: why? Home come we use ADR_REL, ADR_ABS and get the load / linked address? I am really confused about this
  • the assembly of the copy loop itself is a bit confusing - we load from the load address, than we store it but never increment__binary_nonzero_start so I don't see how come the loop ever ends...

Thanks in advance!

You must be logged in to vote

what is a "link address"? I know the rpi loads the kernel to 0x8000 (as specified in the link.ld file), but why do we need to specify the "link address" in the linker file and not just copy wherever we want?

The link address is what the linker uses when it does things like resolvingbranches or calculating addresses. What you can do to get an idea ismake objdump | less, and look around a bit. And then change the link address in the script (do a major change, that will make it more obvious to the eye), and do amake objdump | less again and look at the difference.

The important part to understand here is that whatever you put into the script DOES NOT change the fact that the RPi bootloa…

Replies: 1 comment 1 reply

Comment options

what is a "link address"? I know the rpi loads the kernel to 0x8000 (as specified in the link.ld file), but why do we need to specify the "link address" in the linker file and not just copy wherever we want?

The link address is what the linker uses when it does things like resolvingbranches or calculating addresses. What you can do to get an idea ismake objdump | less, and look around a bit. And then change the link address in the script (do a major change, that will make it more obvious to the eye), and do amake objdump | less again and look at the difference.

The important part to understand here is that whatever you put into the script DOES NOT change the fact that the RPi bootloaders will load the binary at0x8000.

relative/absolute addressing: why? Home come we use ADR_REL, ADR_ABS and get the load / linked address? I am really confused about this

ADR_REL makes the CPU calculate addresses by using the CPU's current program counter.ADR_ABS will resort to hardcoded addresses.

I think it could make sense to skip forward and additionally read the first parts of the README of chapter 15 if you want to get more into the details here. I hope this sheds some more light on what's going on.

the assembly of the copy loop itself is a bit confusing - we load from the load address, than we store it but never increment __binary_nonzero_start so I don't see how come the loop ever ends...

Post-indexed addressing mode is used. Here is the relevant snippet from theARM ARM:
image

You must be logged in to vote
1 reply
@0xmatia
Comment options

Thanks for the detailed reply, it helped a lot :)

Answer selected by0xmatia
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
2 participants
@0xmatia@andre-richter

[8]ページ先頭

©2009-2025 Movatter.jp