extern void start_kernel(void) { // char *ptr = 0x2000001; init_memory(); init_page(); init_sched(); init_tasks(); init_itc(); init_clocks(); spark_registerSysCallHandler(&system_call, 0x90); //spark_print(" ========== Guest 1 :: STARTED\n"); while(1) { int i,j,k, dummy =0; for (k=0; k< 5; k++) { for( i = 0 ; i < 10000; i++) { for(j = 0 ; j < 1000; j++) { // dummy += 5; // if(dummy > 500) // dummy = 0; } } } } }
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; }
int main(multiboot_t * mbp) { cpu_state_t *cpu; // first is to save critical info from bootloader // and get symbol tables so we can print back traces mbootp = mbp; init_debug(mbp); // reset text-mode c80_clear(); printk_color(rc_black, rc_red, "\t\t\t\tRed Magic\n"); // init processors init_bootstrap_processor(); cpu = get_boot_processor(); ASSERT(cpu != NULL); // initialize descriptors init_global_descriptor_table(cpu); init_interrupt_descriptor_table(); init_io_apic(); // interrupt on local_irq_enable(); // memory management show_kernel_pos(); show_ARDS_from_multiboot(mbp); init_paging(); init_kheap(); // initialize devices and rootfs init_dev(); //init_root_fs(); // start all APs if (mpinfo.ismp) start_smp(); // start system clock if (!mpinfo.ismp) init_pit_timer(CLOCK_INT_HZ); else init_apic_timer(CLOCK_INT_HZ); // initialize kernel task and scheduling setup_init_task(); init_sched(); // All our initialisation calls will go in here. return 0xDEADBABA; }
/* kernel_main() * This is called by the low-level architecture startup routine. It sets up * the kernel proper and generally gets the operating system off the ground. */ void kernel_main(unsigned int initial_stack) { initial_esp = initial_stack; /* as given to us by multiboot */ /* Set up the default kernel flags. Change these by adding their * corresponding option when booting the kernel. */ kern.flags.preempt_kernel = TRUE; kern.flags.debug_sched = FALSE; kern.flags.debug_task = FALSE; kern.flags.debug_interrupt = FALSE; kern.flags.debug_ticks = FALSE; kern.flags.stats = FALSE; /* Before we do anything with the higher-level kernel, move the kernel * stack to a known location. This has to copy and remap all absolute * memory addresses. */ move_stack((void *)STACK_LOC, STACK_SIZE); /* Extract and set any options given to the kernel */ parse_cmdline(kern.cmdline); /* Now that all the lower-level startup has been done, we can set up * the higher-level kernel functions. */ init_vt(); print_startup(); setup_initrd(); load_kernel_symbols(); init_sched(); init_task(); create_init(); /* Start the kthread daemon going to set up other kernel threads */ kthread_create(kthreadd, "kthreadd"); /* And we're done */ kprintf("Kernel startup complete in %ldms\n\n", kern.current_time_offset.tv_msec); /* We need to wait a bit here for all the threads to settle themselves * before going away. */ sleep(100); /* The kernel task has finished the startup, so remove the task from the * system. This should never return, so panic if it does. */ task_exit(); panic("Kernel task did not die when it was supposed to :-("); }
int rumpuser_init(int version, const struct rumpuser_hyperup *hyp) { if (version != RUMPUSER_VERSION) { printk("rumpuser version mismatch\n"); abort(); } rumpuser__hyp = *hyp; init_sched(hyp); return 0; }
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 }
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 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"); } }
int main ( int argc, char** argv ) { ptr_f f_; ptr_f g_; int res; init_sched(); f_ = &f; new_proc(f_, 0); res = election(); tproc[res].p_state = SRUNNING; g_ = &f; new_proc(g_, 1); election(); return EXIT_SUCCESS; }
// this is main() function for other processors static int __main(cpu_state_t * cpu) { // init AP init_application_processor(); // init segmentation init_global_descriptor_table(cpu); init_interrupt_descriptor_table(); // enable local interrupt local_irq_enable(); // init paging switch_page_directory(k_pdir); // init sched init_sched(); return 0xFADEFADE; }
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; }
static void start_kernel() { init_clock(); //clock interrupt init get_memsize(&main_memory_end); main_memory_end &= 0xfffff000; paging_init(); init_mem(); //memeory management init buffer_init(); /* scheduler init */ init_sched(); init_hd(); //hard disk init init_fs(); //filesystem init init_task(); /*init_sock();*/ }
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); }
/* * 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(); }