This is an automated email from the ASF dual-hosted git repository.
xiaoxiang pushed a commit to branch releases/12.6
in repository https://gitbox.apache.org/repos/asf/nuttx.git
The following commit(s) were added to refs/heads/releases/12.6 by this push:
new bfd93d41cf arch/riscv: fix PMP in sbi_start()
bfd93d41cf is described below
commit bfd93d41cf26fb1546e1060a5f4f6ad61ba76864
Author: Yanfeng Liu <[email protected]>
AuthorDate: Fri Jun 28 10:45:35 2024 +0800
arch/riscv: fix PMP in sbi_start()
This fixes PMP setting for open everything before going S-mode, which
has been broken since pull/12398.
Signed-off-by: Yanfeng Liu <[email protected]>
---
arch/risc-v/src/nuttsbi/sbi_start.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/arch/risc-v/src/nuttsbi/sbi_start.c
b/arch/risc-v/src/nuttsbi/sbi_start.c
index 7bc9e0a530..8b7aeb2484 100644
--- a/arch/risc-v/src/nuttsbi/sbi_start.c
+++ b/arch/risc-v/src/nuttsbi/sbi_start.c
@@ -32,6 +32,12 @@
#include "sbi_internal.h"
+/****************************************************************************
+ * Preprocecssor definitions
+ ****************************************************************************/
+
+#define NAPOT_OPENALL (PMPCFG_A_NAPOT | PMPCFG_RWX_MASK)
+
/****************************************************************************
* Private Functions
****************************************************************************/
@@ -119,7 +125,7 @@ void sbi_start(void)
/* Open everything for PMP */
- riscv_append_pmp_region(PMPCFG_A_NAPOT | PMPCFG_RWX_MASK, 0, -1);
+ DEBUGASSERT(riscv_append_pmp_region(NAPOT_OPENALL, 0, 0) == 0);
/* Then jump to the S-mode start function */