void kmain_bsp(void) { size_t i = 0; for (i = 0; i < 256; ++i) { isr_handlers[i] = (uintptr_t) &fault_gp; } isr_handlers[KEYBOARD_IRQ_VECTOR] = (uintptr_t) &keyboard_handler; char *buffer = (char *) HY_INFO_ROOT->free_paddr; buffer = build_overview(buffer); buffer = build_cpu(&buffer[1]); buffer = build_ioapic(&buffer[1]); buffer = build_memory(&buffer[1]); buffer = build_modules(&buffer[1]); ui_display(0, 0); asm volatile ("sti"); keyboard_init(); while (1); }
void simulate(int (*allocate)(int, int), char *title) { head = build_memory(); int i; int traversed = 0; int hits = 0; /* circular list to keep track of PIDs allocated */ Node *pIdHead = (Node *)malloc(sizeof(Node)); Node *currentId = pIdHead; currentId->next = pIdHead; for(i = 0; i < NUMREQUESTS; i++) { int pid = random_range(0,999999); if(random_range(0,3) == 1) // 1 in 4 chance for deallocation request choose_deallocate(pIdHead); else { int result = allocate(pid,random_range(3,10)); //int result = allocate(pid,3); if(result != -1) { currentId->pid = pid; currentId->next = (Node *)malloc(sizeof(Node)); currentId = currentId->next; currentId->next = pIdHead; hits++; traversed += result; } } } //print_memory(); printf("%s\n",title); printf("Average Nodes Traversed: %.2f\n",(double)traversed/hits); printf("Request Denial Percentage: %.2f\n",(double)(NUMREQUESTS-hits)/NUMREQUESTS*100); printf("Average Fragments: %.2f\n",(double)fragment_count()/hits); }