COBE 0.1 ALPHA
|
00001 #ifndef MULTITASKING_H 00002 #define MULTITASKING_H 00003 00004 #include <stdint.h> 00005 #include <pmm.h> 00006 #include <pgng.h> 00007 00008 struct cpu_reg_stat { 00009 uint32_t gs __attribute__((aligned(4))), fs __attribute__((aligned(4))), es __attribute__((aligned(4))), ds __attribute__((aligned(4))); 00010 uint32_t eax, ebx, ecx, edx, esi, edi, ebp; 00011 uint32_t interrupt, error; 00012 uint32_t eip, cs, eflags, esp, ss; 00013 }__attribute((packed)); 00014 00015 typedef struct tss{ 00016 uint32_t prev_tss; 00017 uint32_t esp0; 00018 uint32_t ss0; 00019 uint32_t esp1; 00020 uint32_t ss1; 00021 uint32_t esp2; 00022 uint32_t ss2; 00023 uint32_t cr3; 00024 uint32_t eip; 00025 uint32_t eflags; 00026 uint32_t eax; 00027 uint32_t ecx; 00028 uint32_t edx; 00029 uint32_t ebx; 00030 uint32_t esp; 00031 uint32_t ebp; 00032 uint32_t esi; 00033 uint32_t edi; 00034 uint32_t es; 00035 uint32_t cs; 00036 uint32_t ss; 00037 uint32_t ds; 00038 uint32_t fs; 00039 uint32_t gs; 00040 uint32_t ldt; 00041 uint32_t trp; 00042 uint32_t iomap; 00043 } new_tss_t; 00044 00045 typedef struct cpu_reg_stat cpu_regs; 00046 00047 typedef struct task { 00048 struct cpu_reg_stat* cpu_state; 00049 struct task* next_task; 00050 struct paging_directory* task_pd; 00051 struct phy_alloc_list* memory_list; 00052 uint32_t kernel_stack; 00053 uint32_t usr_stack; 00054 uint16_t pid; 00055 char name[40]; 00056 } new_task_t; 00057 00058 typedef struct phy_alloc_list { 00059 void* addr; 00060 struct phy_alloc_list* next; 00061 } phy_alloc_list_t; 00062 00063 00064 void init_mm(multiboot_info_t*); 00065 void load_grub_module(int,multiboot_info_t*); 00066 void set_tss_stack(uint32_t); 00067 new_task_t* init_task(void*,char*,phy_alloc_list_t*); 00068 uint32_t kill_task(uint32_t); 00069 cpu_regs* schedule(cpu_regs* ); 00070 void new_map_addresses(phy_alloc_list_t*,struct paging_directory*,uint32_t); 00071 void delete_map_addresses(phy_alloc_list_t*,struct paging_directory*); 00072 00073 #endif