Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

what does this ARM instruction asm("b .\n"); mean?

the following code is seen in reset handler: asm("b .\n");

This is arm for processor. Can someone explain this?

like image 583
kiran bobbu Avatar asked Dec 14 '25 11:12

kiran bobbu


1 Answers

Reset handlers comes into picture when there is some Fault exception. Now you can build handlers to cover these exceptions but to keep bootloaders simple they are usually kept infinite loops(which is essentially what this asm code is).

Now to state that exceptions are not expected at bootloader stage is not essentially true. Even after development stages there can be exceptions, which are mostly of Hardware related; example bootloader unable to initialize some HW because it has gone bad.

Also at bootloader stage rebooting the system in reset handler doesn't make any sense, as whatever caused the fault in this stage will likely happen again in the next bootup and the system will keep rebooting. At least this way debugger can be attached and even though cpu registers will be useless, bootloader logs, ram content can be collected and analysed.

like image 159
indraforyou Avatar answered Dec 17 '25 00:12

indraforyou



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!