boot: fix potential bl jump to app failed issue
After changing sp, following functions calling will result in unpredictable behavior in case of jumping Signed-off-by: wanggang26 <wanggang26@xiaomi.com>
This commit is contained in:
parent
ab92b7d04d
commit
289fc24b32
@ -172,10 +172,12 @@ int board_boot_image(const char *path, uint32_t hdr_size)
|
|||||||
|
|
||||||
/* Set main and process stack pointers */
|
/* Set main and process stack pointers */
|
||||||
|
|
||||||
__asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr));
|
__asm__ __volatile__("\tmsr msp, %0\n"
|
||||||
setcontrol(0x00);
|
"\tmsr control, %1\n"
|
||||||
ARM_ISB();
|
"\tisb\n"
|
||||||
((void (*)(void))vt.reset)();
|
"\tmov pc, %2\n"
|
||||||
|
:
|
||||||
|
: "r" (vt.spr), "r" (0), "r" (vt.reset));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -161,10 +161,12 @@ int board_boot_image(const char *path, uint32_t hdr_size)
|
|||||||
|
|
||||||
/* Set main and process stack pointers */
|
/* Set main and process stack pointers */
|
||||||
|
|
||||||
__asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr));
|
__asm__ __volatile__("\tmsr msp, %0\n"
|
||||||
setcontrol(0x00);
|
"\tmsr control, %1\n"
|
||||||
ARM_ISB();
|
"\tisb\n"
|
||||||
((void (*)(void))vt.reset)();
|
"\tmov pc, %2\n"
|
||||||
|
:
|
||||||
|
: "r" (vt.spr), "r" (0), "r" (vt.reset));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -161,10 +161,12 @@ int board_boot_image(const char *path, uint32_t hdr_size)
|
|||||||
|
|
||||||
/* Set main and process stack pointers */
|
/* Set main and process stack pointers */
|
||||||
|
|
||||||
__asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr));
|
__asm__ __volatile__("\tmsr msp, %0\n"
|
||||||
setcontrol(0x00);
|
"\tmsr control, %1\n"
|
||||||
ARM_ISB();
|
"\tisb\n"
|
||||||
((void (*)(void))vt.reset)();
|
"\tmov pc, %2\n"
|
||||||
|
:
|
||||||
|
: "r" (vt.spr), "r" (0), "r" (vt.reset));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -183,10 +183,12 @@ int board_boot_image(const char *path, uint32_t hdr_size)
|
|||||||
|
|
||||||
/* Set main and process stack pointers */
|
/* Set main and process stack pointers */
|
||||||
|
|
||||||
__asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr));
|
__asm__ __volatile__("\tmsr msp, %0\n"
|
||||||
setcontrol(0x00);
|
"\tmsr control, %1\n"
|
||||||
ARM_ISB();
|
"\tisb\n"
|
||||||
((void (*)(void))vt.reset)();
|
"\tmov pc, %2\n"
|
||||||
|
:
|
||||||
|
: "r" (vt.spr), "r" (0), "r" (vt.reset));
|
||||||
|
|
||||||
#else
|
#else
|
||||||
/* Non-secure entry point */
|
/* Non-secure entry point */
|
||||||
|
@ -178,10 +178,12 @@ int board_boot_image(const char *path, uint32_t hdr_size)
|
|||||||
|
|
||||||
/* Set main and process stack pointers */
|
/* Set main and process stack pointers */
|
||||||
|
|
||||||
__asm__ __volatile__("\tmsr msp, %0\n" : : "r" (vt.spr));
|
__asm__ __volatile__("\tmsr msp, %0\n"
|
||||||
setcontrol(0x00);
|
"\tmsr control, %1\n"
|
||||||
ARM_ISB();
|
"\tisb\n"
|
||||||
((void (*)(void))vt.reset)();
|
"\tmov pc, %2\n"
|
||||||
|
:
|
||||||
|
: "r" (vt.spr), "r" (0), "r" (vt.reset));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user