1
0
mirror of https://github.com/trezor/trezor-firmware.git synced 2025-02-07 13:12:41 +00:00

refactor(core): stop using shutdown_privileged directly

[no changelog]
This commit is contained in:
cepetr 2025-01-29 21:34:20 +01:00 committed by cepetr
parent d8e7dc8cd9
commit c30233b832
11 changed files with 13 additions and 16 deletions

View File

@ -29,9 +29,6 @@
#ifdef KERNEL_MODE #ifdef KERNEL_MODE
// from util.s
extern void shutdown_privileged(void);
#define DRBG_RESEED_INTERVAL_CALLS 1000 #define DRBG_RESEED_INTERVAL_CALLS 1000
#define DRBG_TRNG_ENTROPY_LENGTH 50 #define DRBG_TRNG_ENTROPY_LENGTH 50
_Static_assert(CHACHA_DRBG_OPTIMAL_RESEED_LENGTH(1) == DRBG_TRNG_ENTROPY_LENGTH, _Static_assert(CHACHA_DRBG_OPTIMAL_RESEED_LENGTH(1) == DRBG_TRNG_ENTROPY_LENGTH,
@ -192,14 +189,14 @@ void wait_random(void) {
volatile int j = wait; volatile int j = wait;
while (i < wait) { while (i < wait) {
if (i + j != wait) { if (i + j != wait) {
shutdown_privileged(); error_shutdown("(glitch)");
} }
++i; ++i;
--j; --j;
} }
// Double-check loop completion. // Double-check loop completion.
if (i != wait || j != 0) { if (i != wait || j != 0) {
shutdown_privileged(); error_shutdown("(glitch)");
} }
#endif #endif
} }

View File

@ -56,9 +56,7 @@ void PVD_IRQHandler(void) {
// Turn off display backlight // Turn off display backlight
BACKLIGHT_PWM_TIM->BACKLIGHT_PWM_TIM_CCR = 0; BACKLIGHT_PWM_TIM->BACKLIGHT_PWM_TIM_CCR = 0;
#endif #endif
// from util.s error_shutdown("PVD IRQ");
extern void shutdown_privileged(void);
shutdown_privileged();
} }
#endif // defined(KERNEL_MODE) && defined(USE_PVD) #endif // defined(KERNEL_MODE) && defined(USE_PVD)

View File

@ -56,6 +56,6 @@ reset_handler:
// enter the application code // enter the application code
bl main bl main
b shutdown_privileged b system_exit
.end .end

View File

@ -39,7 +39,7 @@ reset_handler:
// enter the application code // enter the application code
bl main bl main
b shutdown_privileged b system_exit
.end .end

View File

@ -34,6 +34,6 @@ reset_handler:
// enter the application code // enter the application code
bl main bl main
b shutdown_privileged b system_exit
.end .end

View File

@ -7,7 +7,7 @@
.global default_handler .global default_handler
.type default_handler, STT_FUNC .type default_handler, STT_FUNC
default_handler: default_handler:
b shutdown_privileged b Default_IRQHandler
.macro add_handler symbol_name:req .macro add_handler symbol_name:req
.word \symbol_name .word \symbol_name

View File

@ -74,6 +74,6 @@ clear_ram:
// enter the application code // enter the application code
bl main bl main
b shutdown_privileged b system_exit
.end .end

View File

@ -57,6 +57,6 @@ reset_handler:
// enter the application code // enter the application code
bl main bl main
b shutdown_privileged b system_exit
.end .end

View File

@ -48,6 +48,6 @@ reset_handler:
// enter the application code // enter the application code
bl main bl main
b shutdown_privileged b system_exit
.end .end

View File

@ -7,7 +7,7 @@
.global default_handler .global default_handler
.type default_handler, STT_FUNC .type default_handler, STT_FUNC
default_handler: default_handler:
b shutdown_privileged b Default_IRQHandler
.macro add_handler symbol_name:req .macro add_handler symbol_name:req
.word \symbol_name .word \symbol_name

View File

@ -635,4 +635,6 @@ void NMI_Handler(void) {
mpu_restore(mpu_mode); mpu_restore(mpu_mode);
} }
void Default_IRQHandler(void) { error_shutdown("Unhandled IRQ"); }
#endif // KERNEL_MODE #endif // KERNEL_MODE