WIP set up per cpu structures for x86-64

only on the boot cpu for now
This commit is contained in:
Travis Geiselbrecht
2024-12-06 21:11:51 -08:00
parent fd79fccdde
commit 902e2fcb8a
8 changed files with 139 additions and 11 deletions

View File

@@ -17,18 +17,19 @@
#include <arch/x86/descriptor.h>
#include <arch/fpu.h>
#if !WITH_SMP
/* we're uniprocessor at this point for x86, so store a global pointer to the current thread */
struct thread *_current_thread;
#endif
static void initial_thread_func(void) __NO_RETURN;
static void initial_thread_func(void) {
int ret;
/* release the thread lock that was implicitly held across the reschedule */
spin_unlock(&thread_lock);
arch_enable_ints();
ret = _current_thread->entry(_current_thread->arg);
thread_t *ct = arch_get_current_thread();
int ret = ct->entry(ct->arg);
thread_exit(ret);
}