amd64: insert idle threads
Signed-off-by: Michael Shaw <m@michaelsshaw.com>
This commit is contained in:
parent
54803ed29b
commit
33d6f72cfe
3 changed files with 14 additions and 2 deletions
|
|
@ -64,4 +64,16 @@ void arch_ap_startup()
|
||||||
wrmsr(IA32_GS_BASE, (u64)this_local);
|
wrmsr(IA32_GS_BASE, (u64)this_local);
|
||||||
|
|
||||||
tss_init(id, this_local);
|
tss_init(id, this_local);
|
||||||
|
|
||||||
|
char buf[64];
|
||||||
|
snprintf(buf, 64, "kidle_cpu%lld", id);
|
||||||
|
|
||||||
|
struct thread *idle = kthread_create(yield, NULL, buf);
|
||||||
|
|
||||||
|
if (idle)
|
||||||
|
kdebug("idle thread inserted for cpu %d\n", id);
|
||||||
|
else
|
||||||
|
panic("failed to create idle thread for cpu %d\n", id);
|
||||||
|
|
||||||
|
this_local->idle_thread = idle;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ tid_t sys_fork()
|
||||||
|
|
||||||
extern void kthread_entry();
|
extern void kthread_entry();
|
||||||
|
|
||||||
struct thread *thread_kthread(void (*fn)(void *), void *arg, const char *name)
|
struct thread *kthread_create(void *fn, void *arg, const char *name)
|
||||||
{
|
{
|
||||||
struct thread *thread = slab_alloc(thread_slab);
|
struct thread *thread = slab_alloc(thread_slab);
|
||||||
if (!thread)
|
if (!thread)
|
||||||
|
|
|
||||||
|
|
@ -77,7 +77,7 @@ ssize_t thread_load_file(const char *file, struct thread *thread);
|
||||||
struct thread *thread_create(void);
|
struct thread *thread_create(void);
|
||||||
struct thread *thread_fork(struct thread *parent);
|
struct thread *thread_fork(struct thread *parent);
|
||||||
int thread_set_entry(struct thread *thread, uaddr_t entry);
|
int thread_set_entry(struct thread *thread, uaddr_t entry);
|
||||||
struct thread *thread_kthread(void (*fn)(void *), void *arg, const char *name);
|
struct thread *kthread_create(void *fn, void *arg, const char *name);
|
||||||
void thread_free(struct thread *thread);
|
void thread_free(struct thread *thread);
|
||||||
void thread_init();
|
void thread_init();
|
||||||
tid_t alloc_tid();
|
tid_t alloc_tid();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue