Functions | |
void | print_ok () |
Print the [ OK ] tag. | |
void | print_error () |
Print the [ ERROR ] tag. | |
void | k_main () |
This is the beginning of the kernel!!! You can figure it as the init task...
| |
Variables | |
task_t * | curr_task |
A pointer to the current running task structure. Declared in task.c. | |
queue_t * | ready_queue |
A pointer to ready queue. Declared in task.c. | |
multiboot_info_t * | boot_info |
The multiboot information pointer from GRUB. | |
dword | PHYS_MEM_DIM |
The physical memory dimension. Initialized in paging.c. | |
int | i |
Used to create initial consoles. |
|
This is the beginning of the kernel!!! You can figure it as the init task...
Definition at line 148 of file main.c.
00149 { 00150 // First of all we MUST initialize paging!!! // 00151 init_paging(); 00152 00153 // Initialize video // 00154 init_video(); 00155 init_main_console(); 00156 00157 // Now we can print some informations... // 00158 kprintf("\n\r<Starting initialization>\n\r"); 00159 kprintf("\n\rKernel is running at virtual address:"); 00160 kprintf("\r %#010x\n\r", (dword)&k_main); 00161 00162 // Get some multiboot informations // 00163 boot_info = (multiboot_info_t *)PHYSICAL((dword)boot_info); 00164 if (boot_info->flags & 0x02) 00165 { 00166 // set_color(DEFAULT_COLOR); 00167 kprintf( "Total amount of conventional memory:"); 00168 kprintf("\r %uKB\n\r", ((dword)boot_info->mem_lower)); 00169 kprintf( "Total amount of extended memory:"); 00170 kprintf("\r %uMB\n\r", PHYS_MEM_DIM/1024/1024); 00171 kprintf("\n\r"); 00172 00173 } 00174 else 00175 { 00176 set_color(LIGHT_RED); 00177 kprintf("\n\rError reading multiboot informations... halting!"); 00178 } 00179 00180 // Initialize clock // 00181 kprintf("Initializing system clock..."); 00182 init_clock(); 00183 print_ok(); 00184 00185 // Reprogram the PIC 8259 (interrupt controller) // 00186 kprintf("Reprogramming PIC 8259..."); 00187 reprogram_PIC(); 00188 print_ok(); 00189 00190 // Installing GDT // 00191 kprintf("Installing kernel GDT..."); 00192 install_GDT(); 00193 print_ok(); 00194 00195 // Installing IDT // 00196 kprintf("Installing kernel IDT..."); 00197 install_IDT(); 00198 print_ok(); 00199 00200 // Initialize memory manager // 00201 kprintf("Initializing memory manager..."); 00202 kmalloc_init(); 00203 print_ok(); 00204 00205 // Initialize memory manager // 00206 kprintf("Initializing DMA allocator..."); 00207 dma_alloc_init(); 00208 print_ok(); 00209 00210 // Initialize multitasking // 00211 kprintf("Initializing multitasking..."); 00212 init_multitasking(); 00213 print_ok(); 00214 00215 // Initialize the Real-Time Clock // 00216 kprintf("Initializing Real-Time Clock..."); 00217 time_init(); 00218 print_ok(); 00219 00220 // Initialize the keyboard // 00221 kprintf("Initializing keyboard..."); 00222 init_keyboard(); 00223 print_ok(); 00224 00225 // Initialize the floppy // 00226 kprintf("Initializing floppy driver..."); 00227 if ( init_floppy() ) 00228 print_ok(); 00229 else 00230 print_error(); 00231 00232 // Auto-mount FAT12 on the floppy // 00233 kprintf("Auto-mounting FAT12 file-system on floppy..."); 00234 if ( Read_FAT() ) 00235 print_ok(); 00236 else 00237 print_error(); 00238 00239 // ******************* Luca Giovacchini ************************* 00240 // Initialize the ide driver // 00241 kprintf("Initializing ide driver..."); 00242 // init ide return error that are not critical so we will ignore that 00243 InitIde(); 00244 print_ok(); 00245 ShowIdeSubData(); 00246 kprintf("\n\r"); 00247 // ************************************************************** 00248 00249 // ********************** Filippo Brogi ************************* 00250 // Initialize the ext2 file-system // 00251 kprintf("Auto-mounting ext2 file-system on /dev/hda1..."); 00252 if ( init_ext2() ) 00253 print_ok(); 00254 else 00255 { 00256 kprintf("\n\rUnable to read the super block!!!"); 00257 print_error(); 00258 } 00259 // ************************************************************** 00260 00261 // Initialize virtual consoles // 00262 kprintf("Creating virtual consoles..."); 00263 create_virtual_console(); 00264 set_color(GREEN); 00265 print_ok(); 00266 00267 // Initialization complete // 00268 kprintf("\n\r<Initialization complete>\n\r"); 00269 set_color(WHITE); 00270 kprintf("\n\r*** Welcome to %s - Kernel [v%s] ***\n\r", KERNEL_NAME, KERNEL_VERSION); 00271 set_color(DEFAULT_COLOR); 00272 00273 // Create a shell task for every console // 00274 for(i=1; i<=10; i++) 00275 { 00276 curr_task->console = i; 00277 if ( i>1 ) clrscr(); 00278 create_kthread(&shell, "MiniShell"); 00279 // create_process(&shell, &shell, 0, "MiniShell", KERNEL_PRIVILEGE); 00280 } 00281 curr_task->console=1; 00282 set_curr_console(1); 00283 00284 // Well done!!! // 00285 auto_kill( 0 ); 00286 } |
|
Print the [ ERROR ] tag.
Definition at line 132 of file main.c.
00133 { 00134 set_color(DEFAULT_COLOR); 00135 kprintf("\r [ ]"); 00136 set_color(LIGHT_RED); 00137 gotoxy(49, -1); 00138 kprintf("ERROR\n\r"); 00139 set_color(DEFAULT_COLOR); 00140 } |
|
Print the [ OK ] tag.
Definition at line 121 of file main.c.
00122 { 00123 set_color(DEFAULT_COLOR); 00124 kprintf("\r [ ]"); 00125 set_color(GREEN); 00126 gotoxy(50, -1); 00127 kprintf("OK\n\r"); 00128 set_color(DEFAULT_COLOR); 00129 } |
|
The multiboot information pointer from GRUB.
|
|
A pointer to the current running task structure. Declared in task.c.
|
|
Used to create initial consoles.
|
|
The physical memory dimension. Initialized in paging.c.
|
|
A pointer to ready queue. Declared in task.c.
|