Skip to content

Commit 39208c2

Browse files
amergnatnashif
authored andcommitted
tests: mem_protect: add riscv support
Add a memory region allocation for RISCV architecture. Also fix an arbitraty value which can't work with RISC-V granularity. Signed-off-by: Alexandre Mergnat <[email protected]>
1 parent 52e6b7f commit 39208c2

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

tests/kernel/mem_protect/mem_protect/src/inherit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ static void access_test(void)
5555
(void) k_timer_status_get(&inherit_timer);
5656
k_msgq_put(&inherit_msgq, (void *)&msg_q_data, K_NO_WAIT);
5757
k_mutex_unlock(&inherit_mutex);
58-
inherit_buf[10] = 0xA5;
58+
inherit_buf[MEM_REGION_ALLOC-1] = 0xA5;
5959
}
6060

6161
static void test_thread_1_for_user(void *p1, void *p2, void *p3)

tests/kernel/mem_protect/mem_protect/src/mem_protect.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,8 @@ static inline void set_fault_valid(bool valid)
100100
#define MEM_REGION_ALLOC (Z_ARC_MPU_ALIGN)
101101
#elif defined(CONFIG_ARM)
102102
#define MEM_REGION_ALLOC (Z_THREAD_MIN_STACK_ALIGN)
103+
#elif defined(CONFIG_RISCV)
104+
#define MEM_REGION_ALLOC (Z_RISCV_PMP_ALIGN)
103105
#else
104106
#error "Test suite not compatible for the given architecture"
105107
#endif

0 commit comments

Comments
 (0)