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:
parent
d8e7dc8cd9
commit
c30233b832
@ -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
|
||||||
}
|
}
|
||||||
|
@ -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)
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user