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:
parent
8153144de0
commit
7353c7f95d
5 changed files with 7 additions and 9 deletions
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
|
@ -760,7 +760,7 @@ static uintptr_t handler_bad_syscall(uintptr_t bad_id, uintptr_t arg2,
|
|||
void *ssf)
|
||||
{
|
||||
LOG_ERR("Bad system call id %" PRIuPTR " invoked", bad_id);
|
||||
arch_syscall_oops(_current_cpu->syscall_frame);
|
||||
arch_syscall_oops(_current->syscall_frame);
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
|
@ -769,7 +769,7 @@ static uintptr_t handler_no_syscall(uintptr_t arg1, uintptr_t arg2,
|
|||
uintptr_t arg5, uintptr_t arg6, void *ssf)
|
||||
{
|
||||
LOG_ERR("Unimplemented system call");
|
||||
arch_syscall_oops(_current_cpu->syscall_frame);
|
||||
arch_syscall_oops(_current->syscall_frame);
|
||||
CODE_UNREACHABLE; /* LCOV_EXCL_LINE */
|
||||
}
|
||||
|
||||
|
|
|
@ -255,7 +255,7 @@ def marshall_defs(func_name, func_type, args):
|
|||
else:
|
||||
mrsh += "\t\t" + "uintptr_t arg3, uintptr_t arg4, void *more, void *ssf)\n"
|
||||
mrsh += "{\n"
|
||||
mrsh += "\t" + "_current_cpu->syscall_frame = ssf;\n"
|
||||
mrsh += "\t" + "_current->syscall_frame = ssf;\n"
|
||||
|
||||
for unused_arg in range(nmrsh, 6):
|
||||
mrsh += "\t(void) arg%d;\t/* unused */\n" % unused_arg
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue