riscv: implements arch_thread_priv_stack_space_get
This implements arch_thread_priv_stack_space_get() so this can be used to figure out how much privileged stack space is used. Signed-off-by: Daniel Leung <daniel.leung@intel.com>
This commit is contained in:
parent
bb313355f3
commit
0962114f2b
2 changed files with 13 additions and 0 deletions
|
|
@ -121,6 +121,7 @@ config RISCV
|
|||
select SCHED_IPI_SUPPORTED if SMP
|
||||
select ARCH_HAS_DIRECTED_IPIS
|
||||
select BARRIER_OPERATIONS_BUILTIN
|
||||
select ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET if USERSPACE
|
||||
imply XIP
|
||||
help
|
||||
RISCV architecture
|
||||
|
|
|
|||
|
|
@ -195,6 +195,18 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
|
|||
CODE_UNREACHABLE;
|
||||
}
|
||||
|
||||
int arch_thread_priv_stack_space_get(const struct k_thread *thread, size_t *stack_size,
|
||||
size_t *unused_ptr)
|
||||
{
|
||||
if ((thread->base.user_options & K_USER) != K_USER) {
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
*stack_size = Z_STACK_PTR_ALIGN(K_KERNEL_STACK_RESERVED + CONFIG_PRIVILEGED_STACK_SIZE);
|
||||
|
||||
return z_stack_space_get((void *)thread->arch.priv_stack_start, *stack_size, unused_ptr);
|
||||
}
|
||||
|
||||
#endif /* CONFIG_USERSPACE */
|
||||
|
||||
#ifndef CONFIG_MULTITHREADING
|
||||
|
|
|
|||
Loading…
Reference in a new issue