Skip to content

Commit 968dcc9

Browse files
niedzwiecki-dawidkartben
authored andcommitted
arch: riscv: guard some funcions
Guard some functions with ifdefs to avoid unused function compilation errors. Signed-off-by: Dawid Niedzwiecki <[email protected]>
1 parent 362e17a commit 968dcc9

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

arch/riscv/core/pmp.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,7 @@ static bool set_pmp_entry(unsigned int *index_p, uint8_t perm,
204204
return ok;
205205
}
206206

207+
#ifdef CONFIG_PMP_STACK_GUARD
207208
static inline bool set_pmp_mprv_catchall(unsigned int *index_p,
208209
unsigned long *pmp_addr, unsigned long *pmp_cfg,
209210
unsigned int index_limit)
@@ -231,6 +232,7 @@ static inline bool set_pmp_mprv_catchall(unsigned int *index_p,
231232

232233
return ok;
233234
}
235+
#endif /* CONFIG_PMP_STACK_GUARD */
234236

235237
/**
236238
* @brief Write a range of PMP entries to corresponding PMP registers
@@ -447,6 +449,7 @@ void z_riscv_pmp_init(void)
447449
/**
448450
* @Brief Initialize the per-thread PMP register copy with global values.
449451
*/
452+
#if (defined(CONFIG_PMP_STACK_GUARD) && defined(CONFIG_MULTITHREADING)) || defined(CONFIG_USERSPACE)
450453
static inline unsigned int z_riscv_pmp_thread_init(unsigned long *pmp_addr,
451454
unsigned long *pmp_cfg,
452455
unsigned int index_limit)
@@ -466,6 +469,7 @@ static inline unsigned int z_riscv_pmp_thread_init(unsigned long *pmp_addr,
466469

467470
return global_pmp_end_index;
468471
}
472+
#endif
469473

470474
#ifdef CONFIG_PMP_STACK_GUARD
471475

0 commit comments

Comments
 (0)