diff --git a/sys/amd64/thread.c b/sys/amd64/thread.c index ca48948..09db89b 100644 --- a/sys/amd64/thread.c +++ b/sys/amd64/thread.c @@ -13,7 +13,9 @@ #include #include -extern void ThreadKThreadEntry(TrapFrame *tf); +extern TaskStateSegment64 TSS[MAX_CPUS]; +extern Thread *curProc[MAX_CPUS]; +extern Spinlock schedLock; extern void switchstack(uint64_t *oldrsp, uint64_t rsp); void @@ -22,6 +24,16 @@ Thread_InitArch(Thread *thr) thr->arch.useFP = true; } +void +ThreadKThreadEntry(TrapFrame *tf) __NO_LOCK_ANALYSIS +{ + TSS[CPU()].rsp0 = curProc[CPU()]->kstack + 4096; + + Spinlock_Unlock(&schedLock); + + Trap_Pop(tf); +} + void Thread_SetupKThread(Thread *thr, void (*f)(), uintptr_t arg1, uintptr_t arg2, uintptr_t arg3) @@ -78,8 +90,6 @@ Thread_SetupUThread(Thread *thr, uintptr_t rip, uintptr_t arg) thr->ustack, arg); } -extern TaskStateSegment64 TSS[MAX_CPUS]; - void Thread_SwitchArch(Thread *oldthr, Thread *newthr) { diff --git a/sys/kern/thread.c b/sys/kern/thread.c index 3094156..382ed1b 100644 --- a/sys/kern/thread.c +++ b/sys/kern/thread.c @@ -309,18 +309,6 @@ Thread_Wait(Thread *thr, uint64_t tid) return 0; } -extern TaskStateSegment64 TSS[MAX_CPUS]; - -void -ThreadKThreadEntry(TrapFrame *tf) __NO_LOCK_ANALYSIS -{ - TSS[CPU()].rsp0 = curProc[CPU()]->kstack + 4096; - - Spinlock_Unlock(&schedLock); - - Trap_Pop(tf); -} - /* * Debugging */