summaryrefslogtreecommitdiff
path: root/kernel/kernel.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/kernel.c')
-rw-r--r--kernel/kernel.c70
1 files changed, 33 insertions, 37 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c
index 7784e64..97aef77 100644
--- a/kernel/kernel.c
+++ b/kernel/kernel.c
@@ -1,26 +1,24 @@
+#include <stdint.h>
#include "kernel/kernel.h"
-#include <stdint.h>
+#include "kernel/mem.h"
+#include "kernel/vmem.h"
+#include "kernel/gdt.h"
+#include "kernel/scheduler.h"
+#include "kernel/multiboot.h"
#include "driver/serial.h"
#include "driver/timer.h"
#include "driver/keyboard.h"
#include "driver/mouse.h"
-#include "kernel/gdt.h"
-#include "kernel/scheduler.h"
-
#include "syscalls.h"
#include "types.h"
#include "fifo.h"
-#include "mem.h"
-#include "vmem.h"
#include "mp.h"
#include "interrupts.h"
-#include "multiboot.h"
#include "ringbuffer.h"
-#include "multiboot.h"
#include "terminal/terminal.h"
#include "driver/screen.h"
@@ -28,64 +26,62 @@
void kernel_main(uint32_t eax,uint32_t ebx)
{
serial_init();
+ klog("FOOL-OS ver-%s (%s)",GIT_REVISION,__DATE__);
- klog ("%s - BUILD: git-%s (%s %s)",KERNEL_NAME,GIT_REVISION,__DATE__,__TIME__);
-
- klog("COM 1 - initialized");
-
- uint64_t epoch_time=timer_init();
- klog("PIT - initialized. %u seconds passed since 1970.",epoch_time);
+ klog("Programmable Interval Timer (PIT) init ...");
+ uint64_t unixtime=timer_init();
+ klog("Unix Time = %u seconds)",unixtime);
- keyboard_init(0); //sstdin
- klog("Keyboard Initialized");
+ klog("Keyboard init ...");
+ keyboard_init(0);
+ klog("Mouse init ...");
mouse_init();
- klog("Mouse Initialized");
+ klog("Global Descriptor Table (GDT) init ...");
gdt_init();
- klog("GDT Initialized");
- // MULTIBOOT HEADER
- multiboot_information *info=get_multiboot(eax, ebx);
+ klog("Multiboot Structures init ... ");
+ multiboot_information *info;
+ info=get_multiboot(eax, ebx);
- // Gather Info about other processors. (APs = application processors) // ACPI or MP
- //smp_processors procdata;
- //
- //if(!acpi_find(&procdata))
- // if(!mp_find(&procdata))
- // kpanic("ACPI and MP search failed! I do not want to continue!");
-
- // MEMORY INIT (allows allocating and deaclloating physical memory)
+ klog("Symmetrical Multi Processing (SMP) init ... ");
+ smp_processors procdata;
+ if(!acpi_find(&procdata)&&!mp_find(&procdata))kpanic("No ACPI or MP found!");
+
+ klog("Memory init ... ");
uint32_t kernel_blocks=mem_init(info);
- // Mount Root EXT2 ramimage (needs to be done before other processors started, because of /boot/mp.bin)
+ klog("Ram Filesystem init ... "); // required by mp.bin ????
fs_mount(info);
// Start the other Processors (before paging because apic addr etc..?)
//TODO: !!! Check commented out sleep ()!!!
// https://wiki.osdev.org/Symmetric_Multiprocessing
- // smp_log_procdata(&procdata);
- // smp_start_aps(&procdata,"/boot/mp.bin"); //will be copied over mbr
+ klog("Symmetric Multi Processing (SMP) start ... ");
+ smp_log_procdata(&procdata);
+ //smp_start_aps(&procdata,"/boot/mp.bin"); //will be copied over mbr
- // VIRTUAL MEMORY (paging)
+ klog("Vritual Memory / Paging init ... ");
pdirectory *dir=vmem_init(kernel_blocks,(uint32_t)info->framebuffer_addr);
- // PCI Bus
- //pci_init();
+ klog("Peripheral Component Interconnet (PCI) init ... ");
+ pci_init();
- // INIT VESA: TODO: stop and say if not 32bit colormode!
+ klog("Video Electronics Standards Association (VESA) init ... "); // TODO check if text or fb?
uint32_t addr=kballoc(1);
fs_content("/binfont.bin",addr,0x100); // copy 0x100 bytes to 0x7000
-
vesa_init(info->vbe_control_info,info->vbe_mode_info,addr);
- // STREAMS
+ klog("stdin/stdout init ...");
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
+ klog("Interrupt Vector Table (IVT) init ...");
interrupts_init(0x08);
+ klog("Enable Interrupts & Start Scheduling ...");
scheduler_init(dir);
}