1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2024-11-17 05:03:07 +00:00

fix(legacy): better stack setup for debug devices

This commit is contained in:
Ondrej Mikle 2022-09-15 15:51:14 +02:00 committed by matejcik
parent 71e0b8c1c3
commit 8ea3ca4c5e

View File

@ -80,7 +80,11 @@ jump_to_firmware(const vector_table_t *ivt, int trust) {
} else { // untrusted firmware
timer_init();
mpu_config_firmware(); // * configure MPU for the firmware
__asm__ volatile("msr msp, %0" ::"r"(_stack));
// Setup stack in unprivileged mode (MSR works only for privileged)
// This syntax will use _stack as immediate value to put into SP
// instead of dereferencing it
__asm__ volatile("mov sp, %[input]" ::[input] "r"(&_stack));
}
// Jump to address