Refactor thread code for portability.
This commit is contained in:
parent
cf1adfc2a4
commit
7756f5e80c
@ -13,7 +13,9 @@
|
||||
#include <machine/trap.h>
|
||||
#include <machine/pmap.h>
|
||||
|
||||
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)
|
||||
{
|
||||
|
@ -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
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user