xtensa: 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
1dc02fcbda
commit
55ee97c7d2
2 changed files with 18 additions and 0 deletions
|
@ -136,6 +136,7 @@ config XTENSA
|
||||||
select ARCH_MEM_DOMAIN_DATA if USERSPACE
|
select ARCH_MEM_DOMAIN_DATA if USERSPACE
|
||||||
select ARCH_HAS_DIRECTED_IPIS
|
select ARCH_HAS_DIRECTED_IPIS
|
||||||
select THREAD_STACK_INFO
|
select THREAD_STACK_INFO
|
||||||
|
select ARCH_HAS_THREAD_PRIV_STACK_SPACE_GET if USERSPACE
|
||||||
help
|
help
|
||||||
Xtensa architecture
|
Xtensa architecture
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
* SPDX-License-Identifier: Apache-2.0
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <errno.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include <zephyr/kernel.h>
|
#include <zephyr/kernel.h>
|
||||||
|
@ -170,4 +171,20 @@ FUNC_NORETURN void arch_user_mode_enter(k_thread_entry_t user_entry,
|
||||||
|
|
||||||
CODE_UNREACHABLE;
|
CODE_UNREACHABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int arch_thread_priv_stack_space_get(const struct k_thread *thread, size_t *stack_size,
|
||||||
|
size_t *unused_ptr)
|
||||||
|
{
|
||||||
|
struct xtensa_thread_stack_header *hdr_stack_obj;
|
||||||
|
|
||||||
|
if ((thread->base.user_options & K_USER) != K_USER) {
|
||||||
|
return -EINVAL;
|
||||||
|
}
|
||||||
|
|
||||||
|
hdr_stack_obj = (struct xtensa_thread_stack_header *)thread->stack_obj;
|
||||||
|
|
||||||
|
return z_stack_space_get(&hdr_stack_obj->privilege_stack[0],
|
||||||
|
sizeof(hdr_stack_obj->privilege_stack),
|
||||||
|
unused_ptr);
|
||||||
|
}
|
||||||
#endif /* CONFIG_USERSPACE */
|
#endif /* CONFIG_USERSPACE */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue