|
We will now discuss the first of these 2 instruction for ARM.
bl label
Effect:
(1) Save the Program Counter (PC) in the Link Register (LR)
(2) Branch to memory location marked by the label "label"
|
Explanation:
|
main:
mov r0, #1111
mov r1, #1111
bl myMethod
mov r2, #2222
mov r3, #2222
myMethod:
mov r8, #4444
mov r9, #4444
|
I will use EGTAPI in class to show you the executing.
I have taken some snapshot of the execution for my notes.
The content of the registers at the moment the ARM processor executes the bl instruction is as follows:
|
Notice that PC = 33280 which is the location of the "bl myMethod" instruction
The "bl myMethod" instruction will call (= run, jump) the myMethod function which is located at address 33292 as given by EGTAPI:
|
When we click STEP and execute the "bl myMethod" in EGTAPI, we will see these values in the registers:
|
Notice that:
|
How to run the program:
|
OK, now that we left the return address in the LR register; let's see how we can use it to return to its caller.