void kmain(multiboot_info_t* mbd, unsigned long magic) { if(magic != MULTIBOOT_BOOTLOADER_MAGIC) { scrn_setmode(GREEN,BLACK); scrn_print("Algo salio muy muy mal. No se que mas decirte."); return; } scrn_cls(); scrn_setmode(GREEN,BLACK); scrn_print("BIENVENIDO A juampiOS\n\t" "Estamos trabajando para ofrecerle " "el OS del futuro.\n"); scrn_print("INICIALIZANDO GDT..."); gdt_init(); gdt_flush(); scrn_print("OK\nINICIALIZANDO IDT PARA LAS EXCEPCIONES..."); initialize_exception_handlers(); idt_init_exceptions(); remap_pic(); scrn_print("OK\nINICIALIZANDO IDT PARA LAS INTERRUPCIONES Y SYSCALLS..."); irq_init_handlers(); syscalls_initialize(); idt_init_interrupts(); idt_init_syscalls(); idt_flush(); irq_sti_force(); scrn_printf("OK\nCHEQUEANDO ESTADO DE LOS MODULOS..."); scrn_printf("%u MODULOS CARGADOS\n",mbd->mods_count); scrn_print("CHECKEANDO ESTADO DE LA MEMORIA\n"); // Chequeamos que la cantidad de memoria RAM presente. if(mbd->flags & 1) { scrn_printf("\tCantidad de RAM en el sistema:\n" "\t\tLower: %u Kb, Upper: %u Kb\n", mbd->mem_lower,mbd->mem_upper); } else { kernel_panic("Mapa de memoria de GRUB invalido"); } scrn_print("INICIALIZANDO LAS ESTRUCTURAS DE MEMORIA DEL KERNEL..."); module_t* grub_modules = (module_t*) mbd->mods_addr; uint kernel_end_addr = grub_modules[mbd->mods_count-1].mod_end; // El mapa de memoria upper es a partir del primer megabyte ergo el primer // lugar donde nos vamos de largo es 1024 kilobytes mas la memoria que dice GRUB paging_init(kernel_end_addr, (1024+mbd->mem_upper)*1024); scrn_printf("OK\n"); scrn_print("INICIALIZANDO DISCO ATA\n"); hdd_init(); scrn_printf("INICIALIZANDO FILESYSTEM MINIX\n"); init_disk_super_block(); keybuffer_init(1024); scheduler_init(); void * buffer = (void *) grub_modules[0].mod_start; jump_to_initial(buffer); while(1) ; }
static void mcos_page_stats(void) { int row, col, i, j; info_t * info; saved_t * save; if ( mcos.flags & PRINT_LABELS_FLAG ) { row = 1; col = 1; display_topline("**** Multicore OS ****"); scrn_printf(row+1, col, "Duration:"); scrn_printf(row+2, col, "Solution:"); for(j=0; j<MAX_PHILS; j++) { scrn_printf(j+5, 1, "Philosopher %2d:", j + 1); } col = COLUMN_WIDTH_0; for(i=0; i<mcos.nb_lcores; i++) { info = infos[mcos.map_idx2lcores[i]][0]; if ( info == NULL ) continue; j = i-1; scrn_printf(2, col, "%s", info->duration ? " Fixed" : " Forever"); scrn_printf(3, col, "%s", info->solution == CLAIM_BASED ? " Claim-Based" : " Ticket-Based"); scrn_printf(4, col, " --- lcore %d ---", mcos.map_idx2lcores[i]-1); col += COLUMN_WIDTH_1; } mcos.last_row += 2; display_dashline(mcos.last_row); } mcos.flags &= ~PRINT_LABELS_FLAG; col = COLUMN_WIDTH_0; for(i=0; i<mcos.nb_lcores; i++) { for(j=0; j<MAX_PHILS; j++) { info = infos[mcos.map_idx2lcores[i]][j]; if ( info == NULL ) continue; save = &saved[i][j]; // Only change the screen if the value has changed. if ( save->doing != info->doing ) { scrn_printf(j+5, col, "%s", doing_str[info->doing]); save->doing = info->doing; } scrn_printf(j+5, col, "%c", "!@#$%^&*"[save->count]); } if ( info ) col += COLUMN_WIDTH_1; } }
/* Print out the top line on the screen */ void display_topline(const char * msg) { scrn_printf(1, 20, "%s", msg); pktgen_display_set_color("top.copyright"); scrn_puts(" %s", wr_copyright_msg()); pktgen_display_set_color("top.poweredby"); scrn_puts(" %s", wr_powered_by()); pktgen_display_set_color(NULL); }
static __inline__ void display_dashline(int last_row) { int i; scrn_setw(last_row); last_row--; scrn_pos(last_row, 1); for(i=0; i<(mcos.scrn->ncols-15); i++) printf_info("-"); scrn_printf(last_row, 2, " MCOS Demo %s ", mcos_demo_version()); }
/* Print out the dashed line on the screen. */ void display_dashline(int last_row) { int i; scrn_setw(last_row); last_row--; scrn_pos(last_row, 1); pktgen_display_set_color("sep.dash"); for(i=0; i<(scrn->ncols-15); i++) scrn_fprintf(0, 0, stdout, "-"); pktgen_display_set_color("sep.text"); scrn_printf(last_row, 3, " Pktgen %s ", pktgen_version()); pktgen_display_set_color(NULL); }
void pktgen_page_seq(uint32_t pid) { uint32_t i, row, col; port_info_t *info; pkt_seq_t *pkt; char buff[64]; display_topline("<Sequence Page>"); info = &pktgen.info[pid]; row = PORT_STATE_ROW; col = 1; scrn_printf(row, col, "Port: %2d, Sequence Count: %2d of %2d ", pid, info->seqCnt, NUM_SEQ_PKTS); scrn_fgcolor(SCRN_BLUE, SCRN_BOLD); scrn_printf(row++, col + 111, "GTPu"); scrn_printf(row++, col, "%*s %*s%*s%*s%*s%*s%*s%*s%*s%*s%*s", 6, "Seq:", 18, "Dst MAC", 18, "Src MAC", 16, "Dst IP", 18, "Src IP", 12, "Port S/D", 14, "Protocol:VLAN", 4, "CoS", 4, "ToS", 6, "Size", 6, "TEID"); scrn_fgcolor(SCRN_DEFAULT_FG, SCRN_NO_ATTR); for (i = 0; i < NUM_SEQ_PKTS; i++) { pkt = &info->seq_pkt[i]; if (i >= info->seqCnt) { scrn_eol_pos(row++, col); continue; } col = 1; scrn_printf(row, col, "%c%4d:", pkt->seq_enabled ? '*' : ' ', i); col += 7; scrn_printf(row, col, "%*s", 18, inet_mtoa(buff, sizeof(buff), &pkt->eth_dst_addr)); col += 18; scrn_printf(row, col, "%*s", 18, inet_mtoa(buff, sizeof(buff), &pkt->eth_src_addr)); col += 18; scrn_printf(row, col, "%*s", 16, inet_ntop4(buff, sizeof(buff), htonl(pkt->ip_dst_addr.addr.ipv4.s_addr), 0xFFFFFFFF)); col += 16; scrn_printf(row, col, "%*s", 16 + 2, inet_ntop4(buff, sizeof(buff), htonl(pkt->ip_src_addr.addr.ipv4.s_addr), pkt->ip_mask)); col += 18; snprintf(buff, sizeof(buff), "%d/%d", pkt->sport, pkt->dport); scrn_printf(row, col, "%*s", 12, buff); col += 12; snprintf(buff, sizeof(buff), "%s/%s:%04x", (pkt->ethType == ETHER_TYPE_IPv4) ? "IPv4" : (pkt->ethType == ETHER_TYPE_IPv6) ? "IPv6" : "Other", (pkt->ipProto == PG_IPPROTO_TCP) ? "TCP" : (pkt->ipProto == PG_IPPROTO_ICMP) ? "ICMP" : "UDP", pkt->vlanid); scrn_printf(row, col, "%*s", 14, buff); col += 14; scrn_printf(row, col, "%3d", pkt->cos); col += 4; scrn_printf(row, col, "%3d", pkt->tos); col += 4; scrn_printf(row, col, "%5d", pkt->pktSize + FCS_SIZE); col += 6; scrn_printf(row, col, "%5d", pkt->gtpu_teid); row++; } display_dashline(row + 2); }