zephyr/arch
Marcin Szymczyk 292aafef5a arch: riscv: disable interrupts before wfi
According to RISC-V Instruction Set Manual Chapter 3.3.2:
"The operation of WFI must be unaffected by the global interrupt
bits in mstatus
[...]
WFI is also required to resume execution for locally enabled
interrupts pending at any privilege level,
regardless of the global interrupt enable at each privilege level."

Disabling interrupts before executing `wfi` prevents a corner case
where an IRQ is presented just before executing `wfi`,
which would cause it to return directly into `wfi` and potentially
get stuck in sleep, instead of continuing to background processing.

When execution is resumed, interrupts are reenabled
and appropriate IRQ Handlers should be executed.

Signed-off-by: Marcin Szymczyk <marcin.szymczyk@nordicsemi.no>
2024-03-21 14:30:15 +01:00
..
arc hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
arm arm: cortex_m: tracing for custom thread abort func 2024-03-19 13:37:41 -05:00
arm64 arch: arm64: correct a comment on CONFIG_ARM64_STACK_PROTECTION 2024-03-11 08:16:06 -04:00
common hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
mips arch: mips: use LOG_ERR to print exceptions 2023-12-14 09:32:27 +01:00
nios2 arch: guard more code with CONFIG_EXCEPTION_DEBUG 2023-12-14 09:32:27 +01:00
posix arch posix: Clarify some references to native_posix 2024-03-20 15:43:05 +01:00
riscv arch: riscv: disable interrupts before wfi 2024-03-21 14:30:15 +01:00
sparc arch: guard more code with CONFIG_EXCEPTION_DEBUG 2023-12-14 09:32:27 +01:00
x86 x86: use CONFIG_PRIVILEGED_STACK_SIZE for stack size 2024-03-08 09:37:36 +01:00
xtensa xtensa: mpu: introduce CONFIG_XTENSA_MPU_ONLY_SOC_RANGES 2024-03-19 22:17:34 -04:00
archs.yml hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
CMakeLists.txt cmake: enable -Wshadow partially for in-tree code 2023-08-22 11:39:58 +02:00
Kconfig hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
Kconfig.v1 hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00
Kconfig.v2 hwmv2: Introduce Hardware model version 2 and convert devices 2024-03-02 16:56:33 -05:00