As I am working myself into the AT91 Bootstrap project, I have found that its main()
function apparently returns the address of the next-level software component:
int main(void)
{
...
#ifdef CONFIG_BACKUP_MODE
ret = backup_mode_resume();
if (ret) {
/* ...jump to Linux here */
return ret;
}
#endif
...
#if !defined(CONFIG_LOAD_NONE)
return JUMP_ADDR;
#else
return 0;
#endif
}
I am wondering, what happens at this point under the hood:
- Is the return value stored according the normal calling conventions or the return value of
main()
is treated in a specific way? - What processor instructions get executed after the
main()
returns? Is it something in some epilogue ofmain()
or it is some hardware-level behavior of the SAMA5 processor? How exactly does MPU use the return value? - To what extent is such behavior generic: SAMA5? ARM?