arm quits infinite loop

ldr lr,=halt_loop
ldr pc,=main
halt_loop:
b halt_loop

Configuring the link register points to halt_loop, after the end of the main function pc jump run, the value pc link to register lr, then jump on halt_loop this cycle of death, that death is the end of the program cycle meant.

1, if the main loop is dead, then the statement is not executed under this section, cpu running in a straight fetch.
2, if not the main loop, then return to the main, assembly is performed inside this loop.
If you do not do this, cpu will continue down, but not behind the code, it will put garbage data as instruction, undefined instruction exception is triggered, may cause the system to crash on the restart

Guess you like

Origin www.cnblogs.com/retry/p/11612974.html