[mask_rom] Configure stack guard in ePMP init function
The stack is no longer being cleared (we just scramble SRAM instead)
so it is no longer necessary to defer configuration of the stack
guard and it can be integrated into the main ePMP initialization
function.
Signed-off-by: Michael Munday <mike.munday@lowrisc.org>
diff --git a/sw/device/silicon_creator/mask_rom/mask_rom_epmp.S b/sw/device/silicon_creator/mask_rom/mask_rom_epmp.S
index d3d8322..2c91185 100644
--- a/sw/device/silicon_creator/mask_rom/mask_rom_epmp.S
+++ b/sw/device/silicon_creator/mask_rom/mask_rom_epmp.S
@@ -117,7 +117,7 @@
CFG_INDEX(2 % 4, EPMP_CFG_A_NAPOT | EPMP_CFG_LR) /* ROM */
li t1, CFG_INDEX(5 % 4, EPMP_CFG_A_NAPOT | EPMP_CFG_LR) /* eFLASH */
li t2, CFG_INDEX(11 % 4, EPMP_CFG_A_TOR | EPMP_CFG_LRW) /* MMIO */
- li t3, CFG_INDEX(14 % 4, EPMP_CFG_A_NA4 | EPMP_CFG_LRW) | /* Stack Guard */ \
+ li t3, CFG_INDEX(14 % 4, EPMP_CFG_A_NA4 | EPMP_CFG_L) | /* Stack Guard */ \
CFG_INDEX(15 % 4, EPMP_CFG_A_NAPOT | EPMP_CFG_LRW) /* RAM */
csrw pmpcfg0, t0
csrw pmpcfg1, t1
@@ -132,24 +132,3 @@
// Set function size to allow disassembly.
.size mask_rom_epmp_init, .-mask_rom_epmp_init
-
-/**
- * Disable all accesses to the stack guard word.
- *
- * This function follows the standard ILP32 calling convention but does not
- * require a valid stack pointer, thread pointer or global pointer.
- *
- * Clobbers t0.
- */
-mask_rom_epmp_stack_guard_init:
- .globl mask_rom_epmp_stack_guard_init
- .type mask_rom_epmp_stack_guard_init, @function
-
- // Remove all permissions from entry 14 (the stack guard).
- li t0, CFG_INDEX(14 % 4, EPMP_CFG_R | EPMP_CFG_W | EPMP_CFG_X)
- csrc pmpcfg3, t0
-
- ret
-
- // Set function size to allow disassembly.
- .size mask_rom_epmp_stack_guard_init, .-mask_rom_epmp_stack_guard_init
diff --git a/sw/device/silicon_creator/mask_rom/mask_rom_start.S b/sw/device/silicon_creator/mask_rom/mask_rom_start.S
index f597246..df220f2 100644
--- a/sw/device/silicon_creator/mask_rom/mask_rom_start.S
+++ b/sw/device/silicon_creator/mask_rom/mask_rom_start.S
@@ -233,12 +233,9 @@
.extern crt_section_clear
.extern crt_section_copy
.extern mask_rom_epmp_init
- .extern mask_rom_epmp_stack_guard_init
// Must be called prior to any Main RAM access.
- // FIXME: merge these two functions.
call mask_rom_epmp_init
- call mask_rom_epmp_stack_guard_init
/**
* Setup C Runtime