kernel/userspace: Move syscall_frame field to thread struct

The syscall exception frame was stored on the CPU struct during
syscall execution, but that's not right.  System calls might "feel
like" exceptions, but they're actually perfectly normal kernel mode
code and can be preempted and migrated between CPUs at any time.

Put the field on the thread struct.

Signed-off-by: Andy Ross <andrew.j.ross@intel.com>
This commit is contained in:
Andy Ross 2020-02-06 13:39:03 -08:00 committed by Anas Nashif
commit 7353c7f95d
5 changed files with 7 additions and 9 deletions

View file

@ -597,8 +597,11 @@ struct k_thread {
struct _mem_domain_info mem_domain_info;
/** Base address of thread stack */
k_thread_stack_t *stack_obj;
/** current syscall frame pointer */
void *syscall_frame;
#endif /* CONFIG_USERSPACE */
#if defined(CONFIG_USE_SWITCH)
/* When using __switch() a few previously arch-specific items
* become part of the core OS

View file

@ -110,11 +110,6 @@ struct _cpu {
/* one assigned idle thread per CPU */
struct k_thread *idle_thread;
#ifdef CONFIG_USERSPACE
/* current syscall frame pointer */
void *syscall_frame;
#endif
#if (CONFIG_NUM_METAIRQ_PRIORITIES > 0) && (CONFIG_NUM_COOP_PRIORITIES > 0)
/* Coop thread preempted by current metairq, or NULL */
struct k_thread *metairq_preempted;

View file

@ -259,7 +259,7 @@ extern int z_user_string_copy(char *dst, const char *src, size_t maxlen);
#define Z_OOPS(expr) \
do { \
if (expr) { \
arch_syscall_oops(_current_cpu->syscall_frame); \
arch_syscall_oops(_current->syscall_frame); \
} \
} while (false)