I have a problem understnding a branch instruction B arm926ejs_reset_handler
which leaps to the label arm926ejs_reset_handler:
and thus ignores the code in between. I wonder why would anyone do this?
And some additional explanation. Label __start:
is an entry point of the program. Lines that branch instruction ignores are parameters which boot ISROM was supposed to get at startup. But how can boot ISROM get these parameters if we jump over them? It makes no logic to me.
__start:
arm926ejs_reset:
B arm926ejs_reset_handler
.word 0x41676d69
.word 0,0,0,0,0
image_type:
.word 0x0000000A
sizeOfPermanentCode:
.word (__image_size)
.word 0,0
bootparameter:
.word 0
.word 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0
arm926ejs_reset_handler:
There is a difference between data and code - code contains instructions which are executed, while data is used by the code. The fundamental difference is that data (usually) can't be executed.
So as the room in the beginning is used as a storage space for data, the code needs to jump over the data, otherwise the data would be interpreted as code, which would most likely result in illegal instructions and a crash.
Of course the code can access the data if it is located before the current program counter (after the jump) - from the perspective of the code it doesn't make a difference if the data is locate before or after the code.