static int pcx_start(video_adapter_t *adp) { static int modes[] = { M_VGA_CG320, M_VESA_CG640x480, M_VESA_CG800x600, M_VESA_CG1024x768, -1, }; video_info_t info; int i; if (pcx_decoder.data == NULL || pcx_decoder.data_size <= 0 || pcx_init(pcx_decoder.data, pcx_decoder.data_size)) return (ENODEV); if (bootverbose) printf("splash_pcx: image good:\n" " width = %d\n" " height = %d\n" " depth = %d\n" " planes = %d\n", pcx_info.width, pcx_info.height, pcx_info.bpp, pcx_info.planes); for (i = 0; modes[i] >= 0; ++i) { if (vidd_get_info(adp, modes[i], &info) != 0) continue; if (bootverbose) printf("splash_pcx: considering mode %d:\n" " vi_width = %d\n" " vi_height = %d\n" " vi_depth = %d\n" " vi_planes = %d\n", modes[i], info.vi_width, info.vi_height, info.vi_depth, info.vi_planes); if (info.vi_width >= pcx_info.width && info.vi_height >= pcx_info.height && info.vi_depth == pcx_info.bpp && info.vi_planes == pcx_info.planes) break; } splash_mode = modes[i]; if (splash_mode == -1) return (ENODEV); if (bootverbose) printf("splash_pcx: selecting mode %d\n", splash_mode); return (0); }
void init(uint64_t loader, struct unfold64_objl *object_list, struct unfold64_mmap *memory_map) { // parse configuration for (size_t i = 0; i < object_list->count; i++) { if (!strcmp(object_list->entry[i].name, "/boot/pconf")) { config_parse((char*) object_list->entry[i].base); break; } } // initialize the physical memory manager pmm_init(memory_map); // initialize paging pcx_init(); // initialize interrupt handling idt_init(); // allocate the CCB for processor 0 ccb_new(); // initialize LAPIC timer struct ccb *ccb = ccb_get_self(); ccb->lapic->destination_format = 0xFFFFFFFF; ccb->lapic->logical_destination = (ccb->lapic->logical_destination & 0xFFFFFF) | 1; ccb->lapic->lvt_timer = 0x10000; ccb->lapic->lvt_performance_monitoring_counters = 0x400; ccb->lapic->lvt_lint0 = 0x10000; ccb->lapic->lvt_lint1 = 0x10000; ccb->lapic->task_priority = 0; ccb->lapic->spurious_interrupt_vector = 33 | 0x100; ccb->lapic->timer_initial_count = 100000; // roughly 1 KHz ccb->lapic->lvt_timer = 32 | 0x20000; ccb->lapic->timer_divide_configuration = 3; // 16 // initialize interrupt routes // pinion (pagefault, zombie, etc.) interrupt vector page pinion_vector_page_vtable.on_reset = pinion_on_reset; interrupt_add_vector_page(0x0080, &pinion_vector_page_vtable); // IRQ interrupt vector page irq_vector_page_vtable.on_fire = irq_on_fire; irq_vector_page_vtable.on_reset = irq_on_reset; interrupt_add_vector_page(0x0100, &irq_vector_page_vtable); // initialize ACPI (for IRQ routing info) init_acpi(); // allocate initial thread TCB and add to scheduler scheduler_add_tcb(tcb_new()); // schedule first thread scheduler_schedule(); // load kernel image load_kernel(object_list); }