diff options
Diffstat (limited to 'kernel/kernel.c')
| -rw-r--r-- | kernel/kernel.c | 34 |
1 files changed, 19 insertions, 15 deletions
diff --git a/kernel/kernel.c b/kernel/kernel.c index ad09360..6a77fd5 100644 --- a/kernel/kernel.c +++ b/kernel/kernel.c @@ -56,6 +56,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) klog("Read Multiboot Structures ..."); multiboot_information *cfg_multiboot; cfg_multiboot=multiboot_read(eax, ebx,false); + elf_multiboot_read(cfg_multiboot); // just show kernel section headers klog("Read Advanced Power Configuration Interface (ACPI) Structures ..."); acpi_information cfg_acpi; @@ -63,8 +64,6 @@ void kernel_main(uint32_t eax,uint32_t ebx) fixme("Try to read (legacy) multiprocessor mp strucutres as well (see: xxx/mp.c)"); if(!acpi_found) kpanic("We Currently rely on ACPI Structures Sorry!"); - elf_multiboot_read(cfg_multiboot); - // -- GDT -- // klog("Global Descriptor Table (GDT) init ..."); gdt_init(); @@ -75,13 +74,6 @@ void kernel_main(uint32_t eax,uint32_t ebx) interrupts_install(); fixme("register interrupt callback funcs (instead hardcoded dispatcher)"); - // -- APIC -- // - klog("Advanced Programmable Interrupt Controller (APIC) config ..."); - apic_init(&cfg_acpi); - ioapic_config(); - apic_enable(); - apic_init_timer(3);// freq in HZ - // -- MEMORY MANAGEMENT -- // klog("Memory init ... "); mem_init(cfg_multiboot); @@ -97,15 +89,19 @@ void kernel_main(uint32_t eax,uint32_t ebx) x86_set_page_directory(dir); x86_paging_enable(); - // temporary TODO - uint32_t *cpu_mem=0x8000000; //1024 pages from here on are mapped per cpu for testing! TODO: dynamic! - *cpu_mem=apic_id(); + // -- APIC -- // + klog("Advanced Programmable Interrupt Controller (APIC) config ..."); + apic_init(&cfg_acpi); + ioapic_config(); + apic_enable(); + apic_init_timer(3);// freq in HZ // -- RAM IMAGE -- // klog("Ram Filesystem init ... "); fs_mount(cfg_multiboot); // -- VESA -- // + fixme("tell terminal syscall somehow if we are vga or textmode"); 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 font (0x100 bytes) to memory. @@ -113,9 +109,17 @@ void kernel_main(uint32_t eax,uint32_t ebx) // -- STDIN/STDOUT -- // 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 + uint32_t sstdin = syscall_open("stdin",0,0); // stdin 0 + uint32_t sstdout; + if(cfg_multiboot->framebuffer_type==2) // EGA-standard text mode + { + sstdout = syscall_open("term",0,0); // stdout 1 + } + else + { + sstdout = syscall_open("xterm",0,0); // stdout 1 + } klog("Keyboard init ..."); keyboard_init(0); @@ -140,7 +144,7 @@ void kernel_main(uint32_t eax,uint32_t ebx) // now just wait until our scheduler kicks in. while(1){ + syscall_write(sstdout,"dupa",4); asm("hlt"); - PutString("pit cnt: %d",10,10,0xff00ff,asm_pit_get_ticks()/25); } } |
