When RISCV_ALWAYS_SWITCH_THROUGH_ECALL is enabled, do_swap() enables PMP checking in is_kernel_syscall. If the PMP stack guard is triggered and do_swap() is called from the fault handler, a PMP error occurs because the stack usage violates the previous PMP setting. Remove the stack guard setting during a stack overflow handler to allow enabling PMP checking safely in fault handler. Signed-off-by: Jimmy Zheng <jimmyzhe@andestech.com>
18 lines
509 B
C
18 lines
509 B
C
/*
|
|
* Copyright (c) 2022 BayLibre, SAS
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
#ifndef PMP_H_
|
|
#define PMP_H_
|
|
|
|
void z_riscv_pmp_init(void);
|
|
void z_riscv_pmp_stackguard_prepare(struct k_thread *thread);
|
|
void z_riscv_pmp_stackguard_enable(struct k_thread *thread);
|
|
void z_riscv_pmp_stackguard_disable(void);
|
|
void z_riscv_pmp_usermode_init(struct k_thread *thread);
|
|
void z_riscv_pmp_usermode_prepare(struct k_thread *thread);
|
|
void z_riscv_pmp_usermode_enable(struct k_thread *thread);
|
|
|
|
#endif /* PMP_H_ */
|