summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c76
1 files changed, 21 insertions, 55 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 79acf18..5d19e11 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -20,99 +20,65 @@
#include "terminal/terminal.h"
#include "driver/screen.h"
-
/* F00L 0S Entry point (called directly from asm/multiboot.asm */
void kernel_main(uint32_t eax,uint32_t ebx)
{
+ // SERIAL PORT
+ serial_init();
+
+ // PR
+ log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s - compiled on %s at %s",KERNEL_VERSION,__DATE__,__TIME__);
+
+ // PIT TIMER
+ timer_init();
- //
- // STDIN & STDOUT
- //
+ // STREAMS
uint32_t sstdin = syscall_open("stdin",0,0); // stdin 0
uint32_t sstdout = syscall_open("term",0,0); // stdout 1
uint32_t sstderr = syscall_open("stderr",0,0); // stderr 2
- //
- // PR
- //
- log(FOOLOS_MODULE_NAME,FOOLOS_LOG_INFO,"%s - compiled on %s at %s",KERNEL_VERSION,__DATE__,__TIME__);
-
- //
- // Setup Keyboard Driver
- //
+ // KEYBOARD DRIVER
keyboard_init(sstdin);
- //
- // Configuring the PIT timer.
- //
- timer_init();
+ // MOUSE DRIVER
+ mouse_init(sstdin);
- //
// GDT
- //
gdt_setup();
- //
- // Setup Interrupts (code segment: 0x08)
- //
+ // INTERRUPTS (code segment: 0x08)
int_init(0x08);
- //
- // Process Multiboot Header
- //
+ // MULTIBOOT HEADER
multiboot_information *info=get_multiboot(eax, ebx);
- //
- // Gather Info about other processors. (APs = application processors)
- // ACPI or MP
- //
+ // Gather Info about other processors. (APs = application processors) // ACPI or MP
smp_processors procdata;
if(!acpi_find(&procdata))
if(!mp_find(&procdata))
panic(FOOLOS_MODULE_NAME,"ACPI and MP search failed! I do not want to continue!");
- //
- // Memory Init
- //
- // after this is set up we will be able to allocate and deallocate
- // blocks of physical memory :)
- //
+ // MEMORY INIT (allows allocating and deaclloating physical memory)
uint32_t kernel_blocks=mem_init(info);
- //
// Mount Root EXT2 ramimage (needs to be done before other processors started, because of /boot/mp.bin)
- //
fs_mount(info);
- //
// Start the other Processors (before paging because apic addr etc..?)
- //
//TODO: !!! Check commented out sleep ()!!!
smp_log_procdata(&procdata);
smp_start_aps(&procdata,"/boot/mp.bin"); //will be copied over mbr
- //
- // Activate Virtual Memory (paging)
- //
+ // VIRTUAL MEMORY (paging)
pdirectory *dir=vmem_init(kernel_blocks);
- //
- // Scan the PCI Bus
- //
- // We are interested in the E1000 Network Adapter in particular
- // Its driver will be hopefully implemented one day ;) TODO
- //
- //pci_init();
- //
+ // PCI Bus
+ pci_init();
- //
- // Initialize Multitasking
- //
+ // INIT MULTITASKING (and switch to usermode)
task_init(dir);
- //
- // Abvoe should never returon
- //
+ // we should never reach this
panic(FOOLOS_MODULE_NAME,"reached end of kernel.c !!");
}