kernel: add header files
This commit is contained in:
31
arch/x86_64/include/kernel/machine/thread.h
Normal file
31
arch/x86_64/include/kernel/machine/thread.h
Normal file
@@ -0,0 +1,31 @@
|
||||
#ifndef KERNEL_X86_64_THREAD_H_
|
||||
#define KERNEL_X86_64_THREAD_H_
|
||||
|
||||
#include <kernel/sched.h>
|
||||
|
||||
struct ml_cpu_context;
|
||||
|
||||
/* switch from one thread to another. the stack of the `to` thread must have
|
||||
* been prepared in one of two ways:
|
||||
* 1) a previous call to ml_thread_switch where it was the `from` thread.
|
||||
* 2) a call to ml_thread_prepare_kernel_context
|
||||
* the switch occurs entirely with kernel mode. a further return from an
|
||||
* interrupt context is then used to return to usermode if necessary.
|
||||
*/
|
||||
extern void ml_thread_switch(struct thread *from, struct thread *to);
|
||||
|
||||
/* perform the initial transition to userspace. the stack must be prepared using
|
||||
* ml_thread_prepare_user_context before this function can be used */
|
||||
extern void ml_thread_switch_user(void);
|
||||
/* prepare the stack so that ml_thread_switch can jump to the specified IP/SP */
|
||||
extern void ml_thread_prepare_kernel_context(uintptr_t ip, uintptr_t *sp);
|
||||
/* prepare the stack so that ml_thread_switch_user can jump to usermode
|
||||
* with the specified IP/user SP */
|
||||
extern kern_status_t ml_thread_prepare_user_context(
|
||||
virt_addr_t ip,
|
||||
virt_addr_t user_sp,
|
||||
virt_addr_t *kernel_sp,
|
||||
const uintptr_t *args,
|
||||
size_t nr_args);
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user