1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-01-31 01:41:18 +00:00

refactor(core): rename jump_to function

[no changelog]
This commit is contained in:
cepetr 2025-01-29 21:34:20 +01:00 committed by cepetr
parent 2ecf335349
commit bdb3d486e3
10 changed files with 25 additions and 22 deletions

View File

@ -323,7 +323,7 @@ int main(void) {
system_deinit();
// g_boot_command is preserved on STM32U5
jump_to(IMAGE_CODE_ALIGN(BOOTLOADER_START + IMAGE_HEADER_SIZE));
jump_to_next_stage(IMAGE_CODE_ALIGN(BOOTLOADER_START + IMAGE_HEADER_SIZE));
return 0;
}

View File

@ -7,6 +7,7 @@
#include <io/display.h>
#include <sys/bootargs.h>
#include <sys/bootutils.h>
#include <sys/systick.h>
#include <util/flash.h>
#include <util/flash_otp.h>
@ -111,7 +112,7 @@ static int sdl_event_filter(void *userdata, SDL_Event *event) {
return 1;
}
__attribute__((noreturn)) int main(int argc, char **argv) {
int main(int argc, char **argv) {
SDL_SetEventFilter(sdl_event_filter, NULL);
display_init(DISPLAY_RESET_CONTENT);
@ -189,10 +190,12 @@ __attribute__((noreturn)) int main(int argc, char **argv) {
bootloader_main();
hal_delay(3000);
jump_to(0);
jump_to_next_stage(0);
return 0;
}
void jump_to(uint32_t address) {
void jump_to_next_stage(uint32_t address) {
bool storage_is_erased =
storage_empty(&STORAGE_AREAS[0]) && storage_empty(&STORAGE_AREAS[1]);

View File

@ -7,6 +7,4 @@
extern uint8_t *FIRMWARE_START;
__attribute__((noreturn)) void jump_to(uint32_t address);
#endif

View File

@ -382,7 +382,8 @@ void real_jump_to_firmware(void) {
system_deinit();
jump_to(IMAGE_CODE_ALIGN(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE));
jump_to_next_stage(
IMAGE_CODE_ALIGN(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE));
}
#ifdef USE_RESET_TO_BOOT

View File

@ -276,7 +276,8 @@ int main(void) {
system_deinit();
jump_to(IMAGE_CODE_ALIGN(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE));
jump_to_next_stage(
IMAGE_CODE_ALIGN(FIRMWARE_START + vhdr.hdrlen + IMAGE_HEADER_SIZE));
return 0;
}

View File

@ -46,11 +46,11 @@ void __attribute__((noreturn)) reboot_and_upgrade(const uint8_t hash[32]);
void __attribute__((noreturn)) secure_shutdown(void);
// Jumps to the next booting stage (e.g. bootloader to firmware).
// `address` points to the flash at the vector table of the next stage.
// `vectbl_address` points to the flash at the vector table of the next stage.
//
// Before jumping, the function disables all interrupts and clears the
// memory and registers that could contain sensitive information.
void jump_to(uint32_t address);
void jump_to_next_stage(uint32_t vectbl_address);
// Ensure compatible hardware settings before jumping to
// the different booting stage. This function is used to

View File

@ -19,9 +19,9 @@ memset_reg:
.L_loop_end:
bx lr
.global jump_to
.type jump_to, STT_FUNC
jump_to:
.global jump_to_next_stage
.type jump_to_next_stage, STT_FUNC
jump_to_next_stage:
mov r4, r0 // save input argument r0 (the address of the next stage's vector table) (r4 is callee save)
// this subroutine re-points the exception handlers before the C code
// that comprises them has been given a good environment to run.

View File

@ -23,9 +23,9 @@ memset_reg:
// Jump to address given in first argument R0 that points to next's stage's VTOR
// Clear memory and all registers before jump
.global jump_to
.type jump_to, STT_FUNC
jump_to:
.global jump_to_next_stage
.type jump_to_next_stage, STT_FUNC
jump_to_next_stage:
ldr r1, =0
bl jump_to_with_flag

View File

@ -21,9 +21,9 @@ memset_reg:
// Jump to address given in first argument R0 that points to next's stage's VTOR
// Clear memory and all registers before jump
.global jump_to
.type jump_to, STT_FUNC
jump_to:
.global jump_to_next_stage
.type jump_to_next_stage, STT_FUNC
jump_to_next_stage:
mov r4, r0 // save input argument r0 (the address of the next stage's vector table) (r4 is callee save)
// this subroutine re-points the exception handlers before the C code
// that comprises them has been given a good environment to run.

View File

@ -23,9 +23,9 @@ memset_reg:
// Jump to address given in first argument R0 that points to next's stage's VTOR
// Clear memory and all registers before jump
.global jump_to
.type jump_to, STT_FUNC
jump_to:
.global jump_to_next_stage
.type jump_to_next_stage, STT_FUNC
jump_to_next_stage:
mov r4, r0 // save input argument r0 (the address of the next stage's vector table) (r4 is callee save)
// this subroutine re-points the exception handlers before the C code
// that comprises them has been given a good environment to run.