00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #include <agnix/agnix.h>
00015 #include <agnix/tasks.h>
00016 #include <agnix/memory.h>
00017 #include <agnix/linkage.h>
00018 #include <asm/segment.h>
00019 #include <asm/desc.h>
00020 #include <agnix/adi/chips/cpu.h>
00021 #include <agnix/console.h>
00022
00023 u32 idle_esp[0x2000] __attribute__((__section__(".data.init_task")));
00024 struct tss_wrap_s init_tss[MAX_TASKS] __attribute__ ((__aligned__(32)));
00025 struct task_s *init_task[MAX_TASKS];
00026
00027 struct tss_s *idle_tss;
00028 struct task_s *idle_task;
00029 struct tss_s *syscall_tss;
00030 struct task_s *syscall_task;
00031
00032 u16 kernel_task_init(struct task_s **task, struct tss_s **tss, u32 page, u32 eip)
00033 {
00034 struct tss_wrap_s *tss_wrap;
00035
00036 tss_wrap = get_free_tss();
00037 *tss = &(tss_wrap->tss);
00038
00039 if (!page)
00040 page = get_free_pages(1);
00041
00042 *task = (struct task_s *)page;
00043 (*task)->t_pid = 0;
00044 (*task)->t_state = TASK_STAT_STARTING;
00045 (*task)->tss_wrap = tss_wrap;
00046
00047 return task_kernel_create(tss_wrap, eip, page + 0x1000);
00048 }
00049
00050 u16 __init idle_task_init(void)
00051 {
00052 u16 entry;
00053
00054 entry = kernel_task_init(&idle_task, &idle_tss, (u32)idle_esp, 0);
00055 load_TR(entry);
00056
00057 return entry;
00058 }
00059