diff options
| author | Miguel <m.i@gmx.at> | 2018-10-04 00:53:30 +0200 |
|---|---|---|
| committer | Miguel <m.i@gmx.at> | 2018-10-04 00:53:30 +0200 |
| commit | ce16fe524c14ccaae67fb634105da5aef08ead48 (patch) | |
| tree | 03990f29389bd4c55f40b804b809c7060c24c739 /kernel/kernel.c | |
| parent | a455cd5af26bf8731e7c981a9421b16ab34dae6f (diff) | |
moving framebuffer access completely to userspace
Diffstat (limited to 'kernel/kernel.c')
| -rw-r--r-- | kernel/kernel.c | 58 |
1 files changed, 45 insertions, 13 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index 70b1913..3e07fde 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -41,7 +41,32 @@ #include "driver/vesa.h" #include "asm_pit.h" -/* F00L 0S Entry point (called directly from asm/multiboot.asm */ +/** F00L 0S Entry point (called directly from asm/multiboot.asm) + * + * After this procedure completes we are in a well defined state. + * + * * All Processors are up and running in 32bit protected mode. + * * Interrupts are installed and enabled: + * + * - PS/2 Keyboard CPU0 + * - PS/2 Mouse CPU0 + * - PIT Timer (20Hz) (DISABLED in apic.c) CPU0 + * - APIC Timer (Frequency defined in kernel.h) ALL CPUS + * - E1000 CPU0 + * + * * Software Interrupts: + * + * - Syscalls + * - IPI + * + * * Framebuffer is in a known state. + * * Paging is enabled. + * * Each CPU runs on its own stack at VMEM_CPU_STACK + * * Each CPU has its own private page at VMEM_CPU_PRIVATE + * * We are ready to start scheduling on the next interrupt. + * + */ + void kernel_main(uint32_t eax,uint32_t ebx) { // -- COM1 -- // @@ -60,7 +85,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) klog("The Kernel was loaded at: 0x%08X - 0x%08X",get_kernel_start(),get_kernel_end()); klog("0x00000000 - 0x%08X will get identity mapped", VMEM_KERNEL_PAGES*4096); if(kernel_end>=top_kernel_vmem)kpanic("kernel to big. increase VMEM_KERNEL_PAGES"); - fixme("fear overrun of the initial buffer!"); + fixme("still fear overrun of stack"); // -- DISABLE LEGACY PIC -- // klog("Remapping & Disabling Programmable Interrupt Controller (PIC) ..."); @@ -87,7 +112,6 @@ void kernel_main(uint32_t eax,uint32_t ebx) klog("Interrupt Vector Table (IVT) init ..."); interrupts_init(0x08); interrupts_install(); - fixme("register interrupt callback funcs (instead hardcoded dispatcher)"); // -- PCI SCAN --/ klog("PCI init ..."); @@ -120,14 +144,16 @@ void kernel_main(uint32_t eax,uint32_t ebx) ioapic_config(); // -- VESA -- // + /* fixme("tell terminal syscall somehow if we are vga or textmode"); klog("Video Electronics Standards Association (VESA) init ... "); // binfont has to fit in ONE ext2 block // + fixme("support binfonts spanning multiple blocks?"); uint32_t inode= ext2_filename_to_inode(VMEM_EXT2_RAMIMAGE,VESA_FONT_PATH); uint32_t addr= ext2_inode_blockstart( VMEM_EXT2_RAMIMAGE,inode,0); - vesa_init(cfg_multiboot,addr); + vesa_init(cfg_multiboot,addr); // this only sets some internal static variables klog("Compositor init ..."); compositor_init(cfg_multiboot->framebuffer_width,cfg_multiboot->framebuffer_height,cfg_multiboot->framebuffer_pitch); @@ -136,29 +162,35 @@ void kernel_main(uint32_t eax,uint32_t ebx) // -- STD STREAMS -- // klog("Standard Streams init ..."); fd_init_std_streams(0,cfg_multiboot->framebuffer_type!=2); + */ // -- KB -- // klog("Keyboard init ..."); - keyboard_init(0); + keyboard_init(); // -- MOUSE -- // klog("Mouse init ..."); mouse_init(); - // we wait till almost the end since the time will only start ticking after we - // enable interrupts - klog("Programmable Interval Timer (PIT) init ..."); - uint64_t unixtime=timer_init(); - klog("Unix Time = %u seconds",unixtime); - // -- E1000 INIT (TODO: only if present!) --/ if(e1000_addr) { + #ifndef DISABLE_E1000 klog("E1000 init ..."); - // e1000_init(e1000_addr); + e1000_init(e1000_addr); + #endif } + // we wait until the end since the time will only start ticking once + // we enable interrupts. + klog("Programmable Interval Timer (PIT) init ..."); + klog("Reading CMOS Clock ..."); + uint64_t unixtime=timer_init(); + klog("Unix Time = %u seconds",unixtime); + klog("Symmetric Multi Processing (SMP) start ... "); // for(int i=1;i<cfg_acpi.processors;i++)apic_sipi(i,0x7); - smp_bsp(); + + + smp_bsp(); // start base processor } |
