Skip to content

Commit

Permalink
tests: mem_protect: add riscv support
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
amergnat authored and nashif committed Nov 9, 2020
1 parent 52e6b7f commit 39208c2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion tests/kernel/mem_protect/mem_protect/src/inherit.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ static void access_test(void)
(void) k_timer_status_get(&inherit_timer);
k_msgq_put(&inherit_msgq, (void *)&msg_q_data, K_NO_WAIT);
k_mutex_unlock(&inherit_mutex);
inherit_buf[10] = 0xA5;
inherit_buf[MEM_REGION_ALLOC-1] = 0xA5;
}

static void test_thread_1_for_user(void *p1, void *p2, void *p3)
Expand Down
2 changes: 2 additions & 0 deletions tests/kernel/mem_protect/mem_protect/src/mem_protect.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ static inline void set_fault_valid(bool valid)
#define MEM_REGION_ALLOC (Z_ARC_MPU_ALIGN)
#elif defined(CONFIG_ARM)
#define MEM_REGION_ALLOC (Z_THREAD_MIN_STACK_ALIGN)
#elif defined(CONFIG_RISCV)
#define MEM_REGION_ALLOC (Z_RISCV_PMP_ALIGN)
#else
#error "Test suite not compatible for the given architecture"
#endif
Expand Down

0 comments on commit 39208c2

Please sign in to comment.