static int __init uptime_init(void) { startjiffies = jiffies; proc_init(); return 0; }
static void init(void) { /* Enable all the interrupts */ IRQ_ENABLE; /* Initialize debugging module (allow kprintf(), etc.) */ kdbg_init(); /* Initialize system timer */ timer_init(); /* Initialize UART1 */ ser_init(&out, SER_UART1); /* Configure UART1 to work at 115.200 bps */ ser_setbaudrate(&out, 115200); /* Initialize LED driver */ LED_INIT(); /* Initialize the OLED display (RIT128x96) */ rit128x96_init(); /* Draw an empty Bitmap on the screen */ gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT); /* Refresh the display */ rit128x96_blitBitmap(&lcd_bitmap); /* Initialize the keypad driver */ kbd_init(); /* Initialize the internal flash memory */ flash_init(&flash, 0); /* * Kernel initialization: processes (allow to create and dispatch * processes using proc_new()). */ proc_init(); }
void kernel_c(){ //init basic data&struct heap_init(); proc_init(); init_fs(); mem_entity[0]='G'; mem_entity[1]='M'; mem_entity[2]='K'; mem_entity[3]='B'; k_screen_reset(); detect_cpu(); oprintf("detecting cpu...cpu identify:%s\n",cpu_string); // oprintf("mm init..\nring0_pgdir:%x,ring0_pgtbl:%x,base_proc_pgdir:%x,addr_kernel_info:%x,pages:%x\n",RING0_PGDIR,RING0_PGTBL,BASE_PROC_PGDIR,ADDR_KERNEL_INFO,PAGES); global_equal_map(); __asm__("mov $0x101000,%eax\t\n" "mov %eax,%cr3\t\n" "mov %cr0,%eax\t\n" "or $0x80000000,%eax\t\n" "mov %eax,%cr0\t\n" ); oprintf("global page-mapping for kernel built..open MMU\n"); create_kernel_process((int)&idle,9,0xffff,"idle",0); //pid must =0 create_kernel_process((int)hs,2,0xffff,"hs",1);//hs的时间片要非常多,保证在下一轮时间片重置之前不会被挂起 ERR:pid must =1 create_kernel_process((int)fs_ext,4,10,"fs_ext",1);//pid must =2 create_kernel_process((int)mm,3,10,"mm",1);//ERR mm has great prio,because it shall run and prepare condition for other process create_kernel_process((int)tty,5,10,"tty",1); create_kernel_process((int)&p1,8,10,"p1",1); // ofork(t1,9,15,"t1",1); // ofork(t2,9,5,"t2",1); // ofork((int)&p2,7,5,"p2",3); oprintf("basic process ofork done..now open IRQ,proc-dispatch begin\n"); __asm__("sti"); while(1);//内核陷入死循环,等待第一次时钟中断 }
static void init(void) { /* Enable all the interrupts */ IRQ_ENABLE; /* Initialize debugging module (allow kprintf(), etc.) */ kdbg_init(); /* Initialize LED driver */ LED_INIT(); /* Initialize system timer */ timer_init(); /* * Kernel initialization: processes (allow to create and dispatch * processes using proc_new()). */ proc_init(); /* Init spi on dma to drive lcd */ spi_dma_init(&spi); spi_dma_setclock(LCD_SPICLOCK); /* Initialize the dispaly */ lcd_ili9225_init(&spi.fd); /* Init the backligth display leds */ LCD_BACKLIGHT_INIT(); lcd_setBacklight(LCD_BACKLIGHT_MAX); /* Draw an empty Bitmap on the screen */ gfx_bitmapInit(&lcd_bitmap, raster, LCD_WIDTH, LCD_HEIGHT); /* Refresh the display */ lcd_ili9225_blitBitmap(&lcd_bitmap); /* Initialize the keypad driver */ kbd_init(); }
int __noreturn kern_init(void) { extern char edata[], end[]; memset(edata, 0, end - edata); cons_init(); // init the console const char *message = "(THU.CST) os is loading ..."; cprintf("%s\n\n", message); print_kerninfo(); pmm_init(); // init physical memory management pic_init(); // init interrupt controller idt_init(); // init interrupt descriptor table vmm_init(); // init virtual memory management sched_init(); // init scheduler proc_init(); // init process table sync_init(); // init sync struct ide_init(); // init ide devices swap_init(); // init swap fs_init(); // init fs clock_init(); // init clock interrupt intr_enable(); // enable irq interrupt cpu_idle(); // run idle process }
static void init(void) { /* Enable all the interrupts */ IRQ_ENABLE; /* Initialize debugging module (allow kprintf(), etc.) */ kdbg_init(); /* Initialize system timer */ timer_init(); /* Initialize UART0 */ ser_init(&out, SER_UART0); /* Configure UART0 to work at 115.200 bps */ ser_setbaudrate(&out, 115200); /* Initialize LED driver */ LED_INIT(); /* * Kernel initialization: processes (allow to create and dispatch * processes using proc_new()). */ proc_init(); /* Initialize TCP/IP stack */ tcpip_init(NULL, NULL); /* Bring up the network interface */ netif_add(&netif, &ipaddr, &netmask, &gw, NULL, ethernetif_init, tcpip_input); netif_set_default(&netif); netif_set_up(&netif); }
int kern_init(void) { extern char edata[], end[]; memset(edata, 0, end - edata); cons_init(); // init the console const char *message = "(THU.CST) os is loading ..."; cprintf("%s\n\n", message); print_kerninfo(); grade_backtrace(); pic_init(); // init interrupt controller idt_init(); // init interrupt descriptor table pmm_init(); // init physical memory management vmm_init(); // init virtual memory management sched_init(); // init scheduler proc_init(); // init process table swap_init(); // init swap fs_init(); // init fs clock_init(); // init clock interrupt intr_enable(); // enable irq interrupt //LAB1: CAHLLENGE 1 If you try to do it, uncomment lab1_switch_test() // user/kernel mode switch test //lab1_switch_test(); cpu_idle(); // run idle process }
static void init(void) { /* Enable all the interrupts */ IRQ_ENABLE; /* Initialize debugging module (allow kprintf(), etc.) */ kdbg_init(); /* Initialize system timer */ timer_init(); /* Initialize LED driver */ LED_INIT(); LED_OFF(); /* Kernel initialization */ proc_init(); /* Initialize the serial driver */ ser_init(&ser_port, SER_UART2); /* * Hard-code the baud rate to 115.200 bps. * * TODO: implement the baud rate settings as well as other UART * settings over the USB connection. */ ser_setbaudrate(&ser_port, 115200); /* Initialize usb-serial driver */ usbser_init(&usb_port, 0); }
int main(void) { IRQ_ENABLE; kdbg_init(); #if CONFIG_KERN proc_init(); #endif if (!dataflash_testSetup()) { LOG_INFO("DATAFLASH setup..ok\n"); } else { LOG_ERR("DATAFLASH setup..fail!\n"); return EOF; } dataflash_testRun(); for(;;) { } }
int snd_akm4xxx_build_controls(struct snd_akm4xxx *ak) { int err, num_emphs; err = build_dac_controls(ak); if (err < 0) return err; err = build_adc_controls(ak); if (err < 0) return err; if (ak->type == SND_AK4355 || ak->type == SND_AK4358) num_emphs = 1; else if (ak->type == SND_AK4620) num_emphs = 0; else num_emphs = ak->num_dacs / 2; err = build_deemphasis(ak, num_emphs); if (err < 0) return err; err = proc_init(ak); if (err < 0) return err; return 0; }
/** * The entry. */ int main(int argc, char *argv[], char *envp[]) { if (ginfo->status == STATUS_DEBUG) raise(SIGTRAP); cons_init(); const char *message = "(THU.CST) os is loading ..."; kprintf("%s\n\n", message); intr_init(); ide_init(); host_signal_init(); /* Only to initialize lcpu_count. */ mp_init(); pmm_init(); pmm_init_ap(); vmm_init(); sched_init(); proc_init(); swap_init(); fs_init(); sync_init(); umclock_init(); cpu_idle(); host_exit(SIGINT); return 0; }
int kern_init(void) { extern char edata[], end[]; memset(edata, 0, end - edata); cons_init(); // init the console const char *message = "(THU.CST) os is loading ..."; kprintf ("%s\n\n", message); /* Only to initialize lcpu_count. */ mp_init (); pmm_init(); // init physical memory management pmm_init_ap (); pic_init(); // init interrupt controller vmm_init(); // init virtual memory management sched_init(); // init scheduler proc_init(); // init process table sync_init(); // init sync struct ide_init(); // init ide devices swap_init(); // init swap fs_init(); // init fs clock_init(); // init clock interrupt intr_enable(); // enable irq interrupt cpu_idle(); // run idle process }
void k_main(multiboot_info_t * multiboot_info) { system_info.total_memory = multiboot_info->mem_upper; clrscr(); printf("%s\n", &uname); printf(" Copyright 2005-2006 Draco Project\n"); printf("%dM of extended memory.\n", multiboot_info->mem_upper >> 10); cons_attribute = 7; init_gdt(); init_idt(); init_irq(0x20, 0x28); paging_kernel_env(system_info.total_memory / 4); paging_init(); proc_init(); modules_init(multiboot_info); printf("Kernel is initialized.\n"); sti(); while(1); }
static int rasmem_init(void) { ras_debugset(1); ras_retn_iferr(ras_check()); ras_retn_iferr(rasmem_ctor(&gRasMem)); ras_retn_iferr(proc_init(MODULE_NAME, &proc_ops_name(rmem), &gRasMem)); return 0; }
void kern_init(void) { /* create the init proc */ proc_init(&init_proc, ".init", SCHED_CLASS_RR, (void(*)(void *))kernel_start, NULL, init_proc_stack, INIT_PROC_STACK_SIZE); proc_notify(&init_proc); }
inline void init_dev_modules() { proc_init(); con_init("/disk/bin/screen_saver.pso"); serial_init(); hdd_init(); fs_init(); pipe_init(); }
static __init int test_init(void) { printk(KERN_DEBUG "Hello,test!\n"); proc_init(); thread_init(); return 0; }
void arch_init() { pci_init(); #ifdef __CONFIG_ENABLE_MPTABLES__ mptables_parse(); ioapic_init(); // MUST BE AFTER PCI/ISA INIT! // TODO: move these back to regular init. requires fixing the // __CONFIG_NETWORKING__ inits to not need multiple cores running. #endif // this returns when all other cores are done and ready to receive IPIs #ifdef __CONFIG_SINGLE_CORE__ smp_percpu_init(); #else smp_boot(); #endif proc_init(); /* EXPERIMENTAL NETWORK FUNCTIONALITY * To enable, define __CONFIG_NETWORKING__ in your Makelocal * If enabled, will load the rl8168 driver (if device exists) * and will a boot into userland matrix, so remote syscalls can be performed. * If in simulation, will do some debugging information with the ne2k device * * Note: If you use this, you should also define the mac address of the * teathered machine via USER_MAC_ADDRESS in Makelocal. * * Additionally, you should have a look at the syscall server in the tools directory */ #ifdef __CONFIG_NETWORKING__ #ifdef __CONFIG_SINGLE_CORE__ warn("You currently can't have networking if you boot into single core mode!!\n"); #else rl8168_init(); ne2k_init(); e1000_init(); #endif // __CONFIG_SINGLE_CORE__ #endif // __CONFIG_NETWORKING__ perfmon_init(); #ifdef __CONFIG_MONITOR_ON_INT__ /* Handler to read a char from the interrupt source and call the monitor. * Need to read the character so the device will send another interrupt. * Note this will read from both the serial and the keyboard, and throw away * the result. We condition, since we don't want to trigger on a keyboard * up interrupt */ void mon_int(struct trapframe *tf, void *data) { // Enable interrupts here so that we can receive // other interrupts (e.g. from the NIC) enable_irq(); if (cons_getc()) monitor(0); }
int dc_motor_testSetUp(void) { IRQ_ENABLE; kdbg_init(); timer_init(); proc_init(); pwm_init(); adc_init(); return 0; }
static void init(void) { IRQ_ENABLE; kdbg_init(); timer_init(); kbd_init(); proc_init(); PIOA_CODR = LEDR | LEDG | BUZZER_BIT | CUTOFF_PIN | LAND_PIN; PIOA_OER = LEDR | LEDG | BUZZER_BIT | CUTOFF_PIN | LAND_PIN; }
int main(int argc, char *argv[]) { // l10n setlocale(LC_MESSAGES, ""); bindtextdomain("comar", "/usr/share/locale"); bind_textdomain_codeset("comar", "UTF-8"); bind_textdomain_codeset("libc", "UTF-8"); textdomain("comar"); // Parse commandline options cfg_init(argc, argv); // Only root can register bus if (getuid() != 0) { puts(_("System service should be started as root.")); exit(1); } // Initialize main process if (proc_init(argc, argv, "Comar") != 0) { exit(1); } // Start logging if (log_start() != 0) { exit(1); } // Load models if (model_init() != 0) { exit(1); } // Initialize DB if (db_init() != 0) { exit(1); } while (!shutdown_activated) { // Listen for DBus calls dbus_listen(); if (!shutdown_activated) { log_info("DBus connection is lost. Waiting 5 seconds and trying again...\n"); sleep(5); } } model_free(); proc_finish(); return 0; }
int dc_motor_testSetUp(void) { IRQ_ENABLE; kdbg_init(); timer_init(); proc_init(); #if !CFG_PWM_ENABLE_OLD_API pwm_init(); #endif adc_init(); return 0; }
int msg_testSetup(void) { kdbg_init(); kprintf("Init Timer.."); timer_init(); kprintf("Done.\n"); kprintf("Init Process.."); proc_init(); kprintf("Done.\n"); return 0; }
int proc_attach(pid_t pid, int flags, struct proc_handle **pphdl) { struct proc_handle *phdl; int error = 0; int status; if (pid == 0 || pid == getpid()) return (EINVAL); /* * Allocate memory for the process handle, a structure containing * all things related to the process. */ if ((phdl = malloc(sizeof(struct proc_handle))) == NULL) return (ENOMEM); elf_version(EV_CURRENT); error = proc_init(pid, flags, PS_RUN, phdl); if (error != 0) goto out; if (ptrace(PT_ATTACH, phdl->pid, 0, 0) != 0) { error = errno; DPRINTF("ERROR: cannot ptrace child process %d", pid); goto out; } /* Wait for the child process to stop. */ if (waitpid(pid, &status, WUNTRACED) == -1) { error = errno; DPRINTF("ERROR: child process %d didn't stop as expected", pid); goto out; } /* Check for an unexpected status. */ if (WIFSTOPPED(status) == 0) DPRINTFX("ERROR: child process %d status 0x%x", pid, status); else phdl->status = PS_STOP; out: if (error) proc_free(phdl); else *pphdl = phdl; return (error); }
/** * \cond INTERNAL_DOCUMENTATION */ PropagatorPlugin::PropagatorPlugin(Plugin *_plugin) { plugin = _plugin; DynLib* handle = plugin->getHandle(); proc_init = (pluginInitFunction)(handle->loadFunction("OPI_Plugin_init", true)); if(proc_init) { proc_init(this); } proc_propagate = (pluginPropagateFunction)(handle->loadFunction("OPI_Plugin_propagate", true)); setName(plugin->getName()); setAuthor(plugin->getAuthor()); setDescription(plugin->getDescription()); }
void kern_init() { kprintf("Loading IncOS ...\n"); vm_init(); proc_init(); sched_init(); run_boot_modules(); enable_interrupts(); for (;;); }
void __noreturn kern_init(void) { //setup_exception_vector(); tlb_invalidate_all(); /* unsigned base = 0xBE000000; int i, j; for (j = 10; j < 24; ++j) { kprintf("\nj=%d\n\n\n", j); for (i = 0; i < 10; ++i) { int *addr = (int*)(base + i * 4 + (1 << j)); kprintf("0x%08x=0x%04x\n", addr, (*addr)&0xFFFF); } } */ pic_init(); // init interrupt controller cons_init(); // init the console clock_init(); // init clock interrupt // panic("init"); check_initrd(); const char *message = "(THU.CST) os is loading ...\n\n"; kprintf(message); print_kerninfo(); #if 0 kprintf("EX\n"); __asm__ volatile("syscall"); kprintf("EX RET\n"); #endif pmm_init(); // init physical memory management vmm_init(); // init virtual memory management sched_init(); proc_init(); // init process table ide_init(); fs_init(); intr_enable(); // enable irq interrupt //*(int*)(0x00124) = 0x432; //asm volatile("divu $1, $1, $1"); cpu_idle(); }
int main(int argc, char** argv) { ASSERT(argc > 1, "Specify a bytecode file in the first and only argument, please\n"); init_mdata(); // Initalize the instruction defs init_adata(); init_ins_def(); rt_t* runtime = proc_init(argv[1]); // Initalize process proc_run(runtime); // Execute runtime proc_clean(runtime); // Once `proc_run` returns, clean // what sort of mess it made. return 0; }
/** * This is the first real C function ever called. It performs a lot of * hardware-specific initialization, then creates a pseudo-context to * execute the bootstrap function in. */ void kmain() { GDB_CALL_HOOK(boot); dbg_init(); dbgq(DBG_CORE, "Kernel binary:\n"); dbgq(DBG_CORE, " text: 0x%p-0x%p\n", &kernel_start_text, &kernel_end_text); dbgq(DBG_CORE, " data: 0x%p-0x%p\n", &kernel_start_data, &kernel_end_data); dbgq(DBG_CORE, " bss: 0x%p-0x%p\n", &kernel_start_bss, &kernel_end_bss); page_init(); pt_init(); slab_init(); pframe_init(); acpi_init(); apic_init(); pci_init(); intr_init(); gdt_init(); /* initialize slab allocators */ #ifdef __VM__ anon_init(); shadow_init(); #endif vmmap_init(); proc_init(); kthread_init(); #ifdef __DRIVERS__ bytedev_init(); blockdev_init(); #endif void *bstack = page_alloc(); pagedir_t *bpdir = pt_get(); KASSERT(NULL != bstack && "Ran out of memory while booting."); context_setup(&bootstrap_context, bootstrap, 0, NULL, bstack, PAGE_SIZE, bpdir); context_make_active(&bootstrap_context); panic("\nReturned to kmain()!!!\n"); }
/** Main test */ int main( int argc, char **argv ) { setlocale( LC_ALL, "" ); srand( time( 0 ) ); program_name=L"(ignore)"; say( L"Testing low-level functionality"); say( L"Lines beginning with '(ignore):' are not errors, they are warning messages\ngenerated by the fish parser library when given broken input, and can be\nignored. All actual errors begin with 'Error:'." ); proc_init(); halloc_util_init(); event_init(); parser_init(); function_init(); builtin_init(); reader_init(); env_init(); test_util(); test_escape(); test_convert(); test_tok(); test_parser(); test_expand(); test_path(); say( L"Encountered %d errors in low-level tests", err_count ); /* Skip performance tests for now, since they seem to hang when running from inside make (?) */ // say( L"Testing performance" ); // perf_complete(); env_destroy(); reader_destroy(); parser_destroy(); function_destroy(); builtin_destroy(); wutil_destroy(); event_destroy(); proc_destroy(); halloc_util_destroy(); }