int main(void) { print("kernel : gdt loaded\n"); init_idt(); print("kernel : idt loaded\n"); init_pic(); print("kernel : pic configured\n"); hide_cursor(); /* Initialisation du TSS */ asm(" movw $0x38, %ax \n \ ltr %ax"); print("kernel : tr loaded\n"); /* Initialisation de la memoire */ init_mm(); print("kernel : paging enable\n"); sti; print("kernel : interrupts enable\n"); //init_serial(); //print("kernel : serial port enable\n"); // BochsConsolePrint("Bonjour\n"); while (1); }
main(void) { set_eflags(); /* Define the kernel segment registers */ set_seg_regs(__KERNEL_DS, __KERNEL_DS, INITIAL_ESP); printk("Kernel Loaded! "); /* Initialize hardware data */ setGdt(); /* Definicio de la taula de segments de memoria */ setIdt(); /* Definicio del vector de interrupcions */ setTSS(); /* Definicio de la TSS */ /* Initialize Memory */ init_mm(); /* Initialize an address space to be used for the monoprocess version of ZeOS */ /* monoprocess_init_addr_space(); TO BE DELETED WHEN ADDED THE PROCESS MANAGEMENT CODE TO BECOME MULTIPROCESS */ /* Initialize Scheduling */ init_sched(); /* Initialize idle task data */ init_idle(); /* Initialize task 1 data */ init_task1(); /* Initialize keyboard buffer */ init_keyboard_buffer(); /* Move user code/data now (after the page table initialization) */ copy_data((void *) KERNEL_START + *p_sys_size, usr_main, *p_usr_size); /* Adds this call in order to perform test suite provided by lab course */ zeos_init_auxjp(); printk("Entering user mode..."); /* * zeos_ticks must be initialized after memory initialization and just before * enabling interrupts in order to measure the correct elapsed time */ zeos_ticks = 0; enable_int(); /* * We return from a 'theorical' call to a 'call gate' to reduce our privileges * and going to execute 'magically' at 'usr_main'... */ return_gate(__USER_DS, __USER_DS, USER_ESP, __USER_CS, L_USER_START); /* The execution never arrives to this point */ return 0; }
main(void) { set_eflags(); /* Define the kernel segment registers and a stack to execute the 'main' code */ // It is necessary to use a global static array for the stack, because the // compiler will know its final memory location. Otherwise it will try to use the // 'ds' register to access the address... but we are not ready for that yet // (we are still in real mode). set_seg_regs(__KERNEL_DS, __KERNEL_DS, (DWord) &protected_tasks[5]); printk("Kernel Loaded! "); /* Initialize hardware data */ setGdt(); /* Definicio de la taula de segments de memoria */ setIdt(); /* Definicio del vector de interrupcions */ setTSS(); /* Definicio de la TSS */ /* Initialize Memory */ init_mm(); /* Initialize an address space to be used for the monoprocess version of ZeOS */ monoprocess_init_addr_space(); /* TO BE DELETED WHEN ADDED THE PROCESS MANAGEMENT CODE TO BECOME MULTIPROCESS */ /* Initialize Scheduling */ init_sched(); /* Initialize idle task data */ init_idle(); /* Initialize task 1 data */ init_task1(); /* Initialize semaphores */ init_semaphores(); /* Move user code/data now (after the page table initialization) */ copy_data((void *) KERNEL_START + *p_sys_size, usr_main, *p_usr_size); printk("Entering user mode..."); enable_int(); /* * We return from a 'theorical' call to a 'call gate' to reduce our privileges * and going to execute 'magically' at 'usr_main'... */ return_gate(__USER_DS, __USER_DS, USER_ESP, __USER_CS, L_USER_START); /* The execution never arrives to this point */ return 0; }
/* * INITIAL C ENTRY POINT. */ void _minios_start_kernel(start_info_t *si) { bmk_printf_init(minios_putc, NULL); bmk_core_init(STACK_SIZE_PAGE_ORDER, PAGE_SHIFT); arch_init(si); trap_init(); bmk_sched_init(); /* print out some useful information */ minios_printk(" start_info: %p(VA)\n", si); minios_printk(" nr_pages: 0x%lx\n", si->nr_pages); minios_printk(" shared_inf: 0x%08lx(MA)\n", si->shared_info); minios_printk(" pt_base: %p(VA)\n", (void *)si->pt_base); minios_printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames); minios_printk(" mfn_list: %p(VA)\n", (void *)si->mfn_list); minios_printk(" mod_start: 0x%lx(VA)\n", si->mod_start); minios_printk(" mod_len: %lu\n", si->mod_len); minios_printk(" flags: 0x%x\n", (unsigned int)si->flags); minios_printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti(); arch_print_info(); setup_xen_features(); /* Init memory management. */ init_mm(); /* Init time and timers. */ init_time(); /* Init the console driver. */ init_console(); /* Init grant tables */ init_gnttab(); /* Init XenBus */ init_xenbus(); /* Init scheduler. */ bmk_sched_startmain(_app_main, &start_info); bmk_platform_halt("unreachable"); }
main(void) { set_eflags(); /* Define the kernel segment registers */ set_seg_regs(__KERNEL_DS, __KERNEL_DS, KERNEL_ESP); printk("Kernel Loaded! "); /* Initialize hardware data */ setGdt(); /* Definicio de la taula de segments de memoria */ setIdt(); /* Definicio del vector de interrupcions */ setTSS(); /* Definicio de la TSS */ /* Initialize Memory */ init_mm(); /* Initialize an address space to be used for the monoprocess version of ZeOS */ // monoprocess_init_addr_space(); /* TO BE DELETED WHEN ADDED THE PROCESS MANAGEMENT CODE TO BECOME MULTIPROCESS */ /* Initialize Scheduling */ init_sched(); /* Initialize idle task data */ init_idle(); /* Initialize task 1 data */ init_task1(); /* Move user code/data now (after the page table initialization) */ copy_data((void *) KERNEL_START + *p_sys_size, usr_main, *p_usr_size); printk("Entering user mode..."); enable_int(); /* * We return from a 'theorical' call to a 'call gate' to reduce our privileges * and going to execute 'magically' at 'usr_main'... */ return_gate(__USER_DS, __USER_DS, USER_ESP, __USER_CS, L_USER_START); /* The execution never arrives to this point */ return 0; }
void start_kernel(void) { printk("Mirage: start_kernel\n"); /* Set up events. */ init_events(); /* Enable event delivery. This is disabled at start of day. */ local_irq_enable(); setup_xen_features(); /* Init memory management. * Needed for malloc. */ init_mm(); /* Init time and timers. Needed for block_domain. */ init_time(); /* Init the console driver. * We probably do need this if we want printk to send notifications correctly. */ init_console(); /* Init grant tables. */ init_gnttab(); #if 1 /* Call our main function directly, without using Mini-OS threads. */ app_main_thread(NULL); #else /* Init scheduler. */ /* Needed if you want to use create_thread, but we can get away without it. */ init_sched(); /* Init XenBus */ /* Using Mini-OS's XenBus support requires threads. */ init_xenbus(); /* Respond to "xl shutdown". Requires XenBus. */ create_thread("shutdown", shutdown_thread, NULL); create_thread("ocaml", app_main_thread, NULL); /* Everything initialised, start idle thread */ run_idle_thread(); #endif }
static void prepare_newproc(void) { /* Reinitialize proc and task structures */ /* Not handling locks seriously now because multi-thread execve is not implemented yet */ proc.nr_tasks = 1; destroy_mm(proc.mm); // munlock is also done by unmapping mm init_mm(proc.mm); init_reg_state(); reset_signal_state(); // TODO: destroy LDT if it is implemented /* task.tid = getpid(); */ task.clear_child_tid = task.set_child_tid = 0; task.robust_list = 0; close_cloexec(); }
void init(void) { init_video(); init_mm(); init_trap(); init_irq(); init_8259a(); init_keyboard(); init_timer(); init_harddisk(); init_mouse(); io_sti(); init_resource(); do_test(); }
void start_kernel(void) { /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ local_irq_enable(); setup_xen_features(); /* Init memory management. */ init_mm(); /* Init GDT */ init_gdt(); /* Init time and timers. */ init_time(); /* Init the console driver. */ init_console(); /* Init grant tables */ init_gnttab(); /* Init scheduler. */ init_sched(); /* Init XenBus */ init_xenbus(); /* Init futexes */ init_futex(); #ifdef CONFIG_XENBUS create_thread("shutdown", shutdown_thread, NULL); #endif /* Call (possibly overridden) app_main() */ app_main(&start_info); /* Everything initialised, start idle thread */ run_idle_thread(); }
void osmain( void ) { int i; int j=0; char nb[10]; char tmbuf[30]; /* ini screen first,so that we can output info as early as possible */ init_tty(); /* initialize the screen*/ kprintf( "TTY initialized\n" ); /* init both physical and virtual memory */ init_mm(); kprintf( "Memory manager initialized\n" ); init_irq(); /*initialize irq,with all interrupte disabled.*/ kprintf( "IRQ initialized\n" ); kprintf("\nHello\n"); install_syscall(); init_all_tasks(); init_kb(); /* set keyboard IRQ,and enable it */ kprintf( "\nKeyboard initialized\n" ); init_timer(); /* initialize time, enable timer irq */ /* init_system_clock(&real_tm); */ kprintf( "\nTimer initialized\n"); init_system_clock(&start_tm); kprintf("\nSystem start time is \n"); kprintf(timetostr(&start_tm, tmbuf)); kprintf("\nStarting first process....\n"); start_first_process(); kprintf( "\nNow I am doing a loop ,waiting for interrupt :)\n" ); while(1); halt(); }
/* * INITIAL C ENTRY POINT. */ void start_kernel(start_info_t *si) { static char hello[] = "Bootstrapping...\n"; (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello); arch_init(si); trap_init(); /* print out some useful information */ printk("Mirage OS!\n"); printk(" start_info: %p(VA)\n", si); printk(" nr_pages: 0x%lx\n", si->nr_pages); printk(" shared_inf: 0x%08lx(MA)\n", si->shared_info); printk(" pt_base: %p(VA)\n", (void *)si->pt_base); printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames); printk(" mfn_list: %p(VA)\n", (void *)si->mfn_list); printk(" mod_start: 0x%lx(VA)\n", si->mod_start); printk(" mod_len: %lu\n", si->mod_len); printk(" flags: 0x%x\n", (unsigned int)si->flags); printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti(); arch_print_info(); setup_xen_features(); /* Init memory management. */ init_mm(); /* Init time and timers. */ init_time(); /* Call (possibly overridden) app_main() */ app_main(&start_info); }
void kernel_init() { init_gdt(); init_idt(); init_debug(); init_mm(); init_vmm(); init_heap(); init_sched(); console_clear(); cprintk(rc_light_brown, "Welcome to SuperSong's OS, version: %s\n\n", "v0.1"); init_timer(200); cprintk(rc_light_cyan, "kernel in memory start: 0x%x\n", __kernel_mem_start); cprintk(rc_light_cyan, "kernel in memory end: 0x%x\n", __kernel_mem_end); cprintk(rc_light_cyan, "kernel in memory_used: %d KBs\n", (__kernel_mem_end - __kernel_mem_start + 1023) / 1024); show_memory_map(); cprintk(rc_red, "\nThe count of physical memory pages is: %d\n\n", phy_page_count); kthread_create(thread, NULL); enable_intr(); while (1) { cprintk(rc_red, "Thraed1\n"); } while (1) { __asm__ volatile ("hlt"); } }
/* * Big mama top level function. */ void boot_dbase(void) { { if ((string_space = calloc(1, MAX_STRING)) == NULL) { bug("Boot_dbase: can't alloc %d string space.", MAX_STRING); exit(1); } top_string = string_space; fBootDbase = TRUE; } first_banish_user = NULL; first_banish_site = NULL; last_banish_user = NULL; last_banish_site = NULL; /* * Init random number generator. */ { init_mm(); } /* * Loop up the config, helps, and other files. */ { load_config(); load_helps(); fBootDbase = FALSE; log_string("Load_boards: Loading board and note data"); load_boards(); log_string("Load_banishes: Loading banish data"); load_banishes(); log_string("Load_validates: Loading validate data"); load_validates(); } return; }
main(void) { set_eflags(); /* Define the kernel segment registers */ set_seg_regs(__KERNEL_DS, __KERNEL_DS, KERNEL_ESP); printk("Kernel Loaded! "); /* Initialize hardware data */ setGdt(); /* Definicio de la taula de segments de memoria */ setIdt(); /* Definicio del vector de interrupcions */ setTSS(); /* Definicio de la TSS */ /* Initialize Memory */ init_mm(); /* Initialize task 0 data */ //init_task0(); init_sched(); /* Move user code/data now (after the page table initialization) */ copy_data((void *) KERNEL_START + *p_sys_size, usr_main, *p_usr_size); enable_int(); printk("Entering user mode..."); /* * We return from a 'theorical' call to a 'call gate' to reduce our privileges * and going to execute 'magically' at 'usr_main'... */ return_gate(__USER_DS, __USER_DS, USER_ESP, __USER_CS, L_USER_START); /* The execution never arrives to this point */ return 0; }
/** * <Ring 1> The main loop of TASK MM. * *****************************************************************************/ PUBLIC void task_mm() { init_mm(); while (1) { send_recv(RECEIVE, ANY, &mm_msg); int src = mm_msg.source; int reply = 1; int msgtype = mm_msg.type; switch (msgtype) { case FORK: mm_msg.RETVAL = do_fork(); break; case EXIT: do_exit(mm_msg.STATUS); reply = 0; break; case EXEC: mm_msg.RETVAL = do_exec(); break; case WAIT: do_wait(); reply = 0; break; default: dump_msg("MM::unknown msg", &mm_msg); assert(0); break; } if (reply) { mm_msg.type = SYSCALL_RET; send_recv(SEND, src, &mm_msg); } } }
int main(void) { init_pmm(); if (init_mm()) return(1); vid_init(); vid_set_attr(FG_COLOR, RED); printf("\naMOS BOSS V.%s %s\n", STRING_VERSION, BUILD_ARCH); printf("Build %s %s by %s on %s\n\n", COMPILE_DATE, COMPILE_TIME, COMPILE_BY, COMPILE_HOST); vid_set_attr(FG_COLOR, WHITE); init_pit(); init_tss(); if (init_intr()) return(1); init_cpu(); if (init_sched()) return(1); init_fd(); printf("System memory: %d Mb\n\n", (int)pmm_get_size_mb()); printf("Free kernel mem: %d bytes\nUsed kernel mem: %d bytes\n", (int)get_free_mem(), (int)get_used_mem()); for (;;) {} return(0); }
void entry(struct Multiboot_Info_dec * old_mbinfo) { // This function is entered into by the kernel header // which sets up some basic tables for use and passes on // the multiboot info structure struct Multiboot_Info_dec mbinfo; #ifdef DEBUG U8 * screen = (U8 *)0xB8000; U16 i; // Clear the screen so debug messages are more visible for (i = 0; i < 160; i+=2) { screen[i] = ' '; screen[i+1] = 0x17; } for (i = 160; i < 7840; i+=2) { screen[i] = ' '; screen[i+1] = 0x07; } dprint("\t\t\tThe Poseidon Project Kernel.\n\n"); dprint("The Poseidon Project (c) Copyright 1998, 1999 John Barker\n"); dprint("All rights reserved. 32 bit message based real time operating system.\n\n"); #endif // Copy the old table to a local one for safe keeping // because once memory is initialized the old one may be wiped memcpy(&mbinfo,old_mbinfo,sizeof(struct Multiboot_Info_dec)); // Set up the exception traps init_traps(); // Allocate the irq routines init_irqs(); // Initialize memory management so we can use kmalloc and other // memory based functions init_mm(&mbinfo); // Initialize the object manager so we can start using it init_obj(); // Initialize the module/driver interface so modules can be loaded init_mdi(); // Set up the clocks and timers init_time(); // Set up tables and data for the executive init_executive(); // Initialize IPC and message buffers for all objects init_ipc(); // Initialize the system calls (system call interface) init_sci(); // Load all the modules passed to us at boot time, one of these // should be init or main load_modules(&mbinfo); // Start the executive scheduler, will boot the init module start_executive(); // The idle function - just loop, should be run in user mode idle(); }
/** * <Ring 1> The main loop of TASK MM. * *****************************************************************************/ PUBLIC void task_mm() { init_mm(); while (1) { send_recv(RECEIVE, ANY, &mm_msg); int src = mm_msg.source; int reply = 1; int msgtype = mm_msg.type; switch (msgtype) { case FORK: mm_msg.RETVAL = do_fork(); break; case EXIT: do_exit(mm_msg.STATUS); reply = 0; break; case EXEC: mm_msg.RETVAL = do_exec(); break; case WAIT: do_wait(); reply = 0; break; case KILL: mm_msg.RETVAL = do_kill(); break; case RAISE: mm_msg.RETVAL = do_raise(); break; case BRK: mm_msg.RETVAL = do_brk(); break; case ACCT: mm_msg.RETVAL = do_acct(); break; case GETUID: mm_msg.RETVAL = do_getuid(); break; case SETUID: mm_msg.RETVAL = do_setuid(); break; case GETGID: mm_msg.RETVAL = do_getgid(); break; case SETGID: mm_msg.RETVAL = do_setgid(); break; case GETEUID: mm_msg.RETVAL = do_geteuid(); break; case GETEGID: mm_msg.RETVAL = do_getegid(); break; case SIGACTION: mm_msg.RETVAL = do_sigaction(); break; case ALARM: mm_msg.RETVAL = do_alarm(); break; default: dump_msg("MM::unknown msg", &mm_msg); assert(0); break; } if (reply) { mm_msg.type = SYSCALL_RET; send_recv(SEND, src, &mm_msg); } } }
/* * Big mama top level function. */ void boot_db( void ) { /* * Init some data space stuff. */ { if ( ( string_space = calloc( 1, MAX_STRING ) ) == NULL ) { bug( "Boot_db: can't alloc %d string space.", MAX_STRING ); exit( 1 ); } top_string = string_space; fBootDb = TRUE; } /* * Init random number generator. */ { init_mm( ); } /* * Set time and weather. */ { long lhour, lday, lmonth; lhour = (current_time - 650336715) / (PULSE_TICK / PULSE_PER_SECOND); time_info.hour = lhour % 24; lday = lhour / 24; time_info.day = lday % 35; lmonth = lday / 35; time_info.month = lmonth % 17; time_info.year = lmonth / 17; if ( time_info.hour < 5 ) weather_info.sunlight = SUN_DARK; else if ( time_info.hour < 6 ) weather_info.sunlight = SUN_RISE; else if ( time_info.hour < 19 ) weather_info.sunlight = SUN_LIGHT; else if ( time_info.hour < 20 ) weather_info.sunlight = SUN_SET; else weather_info.sunlight = SUN_DARK; weather_info.change = 0; weather_info.mmhg = 960; if ( time_info.month >= 7 && time_info.month <=12 ) weather_info.mmhg += number_range( 1, 50 ); else weather_info.mmhg += number_range( 1, 80 ); if ( weather_info.mmhg <= 980 ) weather_info.sky = SKY_LIGHTNING; else if ( weather_info.mmhg <= 1000 ) weather_info.sky = SKY_RAINING; else if ( weather_info.mmhg <= 1020 ) weather_info.sky = SKY_CLOUDY; else weather_info.sky = SKY_CLOUDLESS; } /* * Assign gsn's for skills which have them. */ { int sn; for ( sn = 0; sn < MAX_SKILL; sn++ ) { if ( skill_table[sn].pgsn != NULL ) *skill_table[sn].pgsn = sn; } } /* * Read in all the area files. */ { FILE *fpList; if ( ( fpList = fopen( AREA_LIST, "r" ) ) == NULL ) { perror( AREA_LIST ); exit( 1 ); } for ( ; ; ) { strcpy( strArea, fread_word( fpList ) ); if ( strArea[0] == '$' ) break; if ( strArea[0] == '-' ) { fpArea = stdin; } else { if ( ( fpArea = fopen( strArea, "r" ) ) == NULL ) { perror( strArea ); exit( 1 ); } } for ( ; ; ) { char *word; if ( fread_letter( fpArea ) != '#' ) { bug( "Boot_db: # not found.", 0 ); exit( 1 ); } word = fread_word( fpArea ); if ( word[0] == '$' ) break; else if ( !str_cmp( word, "AREA" ) ) load_area (fpArea); else if ( !str_cmp( word, "HELPS" ) ) load_helps (fpArea); else if ( !str_cmp( word, "MOBILES" ) ) load_mobiles (fpArea); else if ( !str_cmp( word, "OBJECTS" ) ) load_objects (fpArea); else if ( !str_cmp( word, "RESETS" ) ) load_resets (fpArea); else if ( !str_cmp( word, "ROOMS" ) ) load_rooms (fpArea); else if ( !str_cmp( word, "SHOPS" ) ) load_shops (fpArea); else if ( !str_cmp( word, "SPECIALS" ) ) load_specials(fpArea); else { bug( "Boot_db: bad section name.", 0 ); exit( 1 ); } } if ( fpArea != stdin ) fclose( fpArea ); fpArea = NULL; } fclose( fpList ); } /* * Fix up exits. * Declare db booting over. * Reset all areas once. * Load up the notes file. */ { fix_exits( ); fBootDb = FALSE; area_update( ); load_notes( ); } return; }
int kmain(void* mbinfo, unsigned int magic, unsigned int* pagedirectory){ printf("Magic number: 0x%08X\n", magic); printf("Page directory located at: 0x%08X\n", pagedirectory); printf("Initializing memory management\n"); init_mm(pagedirectory); printf("Multiboot structure at 0x%08X, total size: %u bytes\n",mbinfo,*((unsigned int*)mbinfo)); void* tags_end = mbinfo+*((unsigned int*)mbinfo); mbinfo += 8; while(mbinfo<tags_end){ void* tag_start = mbinfo; unsigned int tag_type = *((unsigned int*)mbinfo); if(!tag_type) break; unsigned int tag_size = *((unsigned int*)(mbinfo+4)); mbinfo+=8; switch(tag_type){ case 1: printf("Command line: %s\n",(char*)mbinfo); break; case 2: printf("Bootloader name: %s\n",(char*)mbinfo); break; case 4: printf("Free: %u KB lower memory, %u KB upper memory\n",*((unsigned int*)mbinfo),*((unsigned int*)(mbinfo+4))); break; case 5: printf("Booted from device 0x%08X, partition 0x%08X, subpartition 0x%08X\n",*((unsigned int*)mbinfo),*((unsigned int*)(mbinfo+4)),*((unsigned int*)(mbinfo+8))); break; case 6: { unsigned int entry_size = *((unsigned int*)mbinfo); mbinfo += 4; printf("Memory map - each entry is version %u and has %u bytes\n", *(unsigned int*)mbinfo, entry_size); mbinfo += 4; while((unsigned int)mbinfo<(unsigned int)tag_start+tag_size){ unsigned long chunk_start = *((unsigned long*)mbinfo); unsigned long chunk_len = *((unsigned long*)(mbinfo+8)); unsigned long chunk_end = chunk_start+chunk_len-1; unsigned int chunk_type = *((unsigned int*)(mbinfo+16)); printf("Entry: %016lX - %016lX, type %u ",chunk_start,chunk_end,chunk_type); switch(chunk_type){ case 1: printf("(available)\n"); break; case 3: printf("(available, ACPI info)\n"); break; case 4: printf("(hibernation-preserved)\n"); break; default: printf("(reserved)\n"); break; } mbinfo+=entry_size; } } break; case 7:{ unsigned short vbe_mode = *((unsigned short*)(mbinfo)); unsigned short vbe_interface_seg = *((unsigned short*)(mbinfo+2)); unsigned short vbe_interface_off = *((unsigned short*)(mbinfo+4)); unsigned short vbe_interface_len = *((unsigned short*)(mbinfo+6)); unsigned char* vbe_control_info = (unsigned short*)(mbinfo+8); unsigned char* vbe_control_info_end = (unsigned short*)(mbinfo+520); unsigned char* vbe_mode_info = (unsigned short*)(mbinfo+520); unsigned char* vbe_mode_info_end = (unsigned short*)(mbinfo+776); printf("VBE mode 0x%08X, interface segment 0x%08X, interface offset 0x%08X, interface length 0x%08X\n", vbe_mode,vbe_interface_seg,vbe_interface_off,vbe_interface_len); printf("VBE control info at 0x%08X, VBE mode info at 0x%08X\n",vbe_control_info,vbe_mode_info); } break; case 8: fb_addr = *((void**)mbinfo); colorbuffer = (unsigned int*) fb_addr; fb_pitch = *((unsigned int*)(mbinfo+8)); fb_width = *((unsigned int*)(mbinfo+12)); fb_height = *((unsigned int*)(mbinfo+16)); fb_bpp = *((unsigned char*)(mbinfo+20)); fb_type = *((unsigned char*)(mbinfo+21)); mbinfo+=22; printf("Framebuffer 0x%016X, pitch %u bytes, resolution %ux%u, %u bpp, type %u\n",fb_addr,fb_pitch,fb_width,fb_height,fb_bpp,fb_type); fb_end = (void*)(fb_addr+fb_pitch*fb_height); for(unsigned int i=fb_addr;i<=fb_end;i+=0x00400000) four_meg_identity_map(i); switch(fb_type){ case 0: printf("Palette (%u colors): ",*((unsigned int*)mbinfo)); while((unsigned int)mbinfo<(unsigned int)tag_start+tag_size){ unsigned char r = *((unsigned char*)mbinfo++); unsigned char g = *((unsigned char*)mbinfo++); unsigned char b = *((unsigned char*)mbinfo++); printf("%02X%02X%02X ",r,g,b); } printf("\n"); } init_video(fb_addr,fb_width,fb_height); redrawallchars(); break; case 9: //printf("ELF section headers, ignoring\n"); break; case 10: //printf("APM info, ignoring\n"); break; default: printf("Unknown tag type %u, size %u, starts at 0x%08X. Contents:\n",tag_type,tag_size,tag_start); while((unsigned int)mbinfo<(unsigned int)tag_start+tag_size){ printf("%c",*((unsigned char*)mbinfo++)); } printf("\n"); break; } mbinfo=tag_start+tag_size; if((unsigned int)mbinfo%8) mbinfo+=(8-(unsigned int)mbinfo%8); } printf("0x%08X : 0x%08X\n",fb_addr, pagedirectory[(unsigned int)fb_addr>>22]); printf("Initializing PIC and IDT\n"); init_pic(); setmask(0xFFFC); init_idt(); printf("Initializing timer to 10 Hz\n"); init_timer(100); asm volatile("sti;"); for(;;){} return 0xC0DED1ED; }
/* * INITIAL C ENTRY POINT. */ void start_kernel(start_info_t *si) { static char hello[] = "Bootstrapping...\n"; (void)HYPERVISOR_console_io(CONSOLEIO_write, strlen(hello), hello); setup_xen_features(); pvh_early_init(); arch_init(si); trap_init(); /* print out some useful information */ printk("Xen Minimal OS!\n"); printk(" start_info: %p(VA)\n", si); printk(" nr_pages: 0x%lx\n", si->nr_pages); printk(" shared_inf: 0x%08lx(MA)\n", si->shared_info); printk(" pt_base: %p(VA)\n", (void *)si->pt_base); printk("nr_pt_frames: 0x%lx\n", si->nr_pt_frames); printk(" mfn_list: %p(VA)\n", (void *)si->mfn_list); printk(" mod_start: 0x%lx(VA)\n", si->mod_start); printk(" mod_len: %lu\n", si->mod_len); printk(" flags: 0x%x\n", (unsigned int)si->flags); printk(" cmd_line: %s\n", si->cmd_line ? (const char *)si->cmd_line : "NULL"); /* Set up events. */ init_events(); /* ENABLE EVENT DELIVERY. This is disabled at start of day. */ __sti(); arch_print_info(); /* Init memory management. */ init_mm(); /* Init time and timers. */ init_time(); /* Init the console driver. */ init_console(); /* Init grant tables */ init_gnttab(); /* Init scheduler. */ init_sched(); /* Init XenBus */ init_xenbus(); #ifdef CONFIG_XENBUS /* Init shutdown thread */ init_shutdown(si); #endif /* Call (possibly overridden) app_main() */ app_main(&start_info); /* Everything initialised, start idle thread */ run_idle_thread(); }