void kmain(struct multiboot_info *mboot_ptr, uint32_t initial_stack) { init_console(); kprintf("Booting garethix, SVN version %s...\n", KERNEL_SVN_REV); kprintf("Build: %s, Build host: %s\n", BUILDTIME, BUILDHOST); kprintf("command line: %s\n",(char*)mboot_ptr->cmdline); detect_cpu(); kprintf("Kernel initrd should be at 0x%x\n", mboot_ptr->mods_addr); kprintf("Dumping memory map:\n"); memory_map_t* mmap = mboot_ptr->mmap_addr; uint32_t largest_mem=0; uint32_t largest_mem_size=0; while(mmap < mboot_ptr->mmap_addr + mboot_ptr->mmap_length) { if (mmap->length_low > largest_mem_size) { largest_mem = mmap->base_addr_low; largest_mem_size = mmap->length_low; } kprintf("0x%x, %d kb", mmap->base_addr_low, mmap->length_low/1024); if (mmap->type==1) { kprintf(" FREE\n"); } else { kprintf(" RESERVED, type %d\n", mmap->type); } mmap = (memory_map_t*) ( (unsigned int)mmap + mmap->size + sizeof(unsigned int) ); } kprintf("Will allocate memory in 0x%x - 0x%x slot\n", largest_mem,largest_mem+largest_mem_size); kprintf("%d pages available\n", largest_mem_size/(4*1024)); #if defined(__i386__) // idt_initialize(); // pic_initialize(); #endif }
ServerWidget::ServerWidget(xonotic::ConnectionDetails details, QWidget* parent) : QWidget(parent), connection(std::move(details)) { menu_quick_commands = new QMenu(tr("Quick Commands"), this); menu_quick_commands->setObjectName("menu_quick_commands"); setupUi(this); button_refresh_status->setShortcut(QKeySequence::Refresh); button_refresh_cvars->setShortcut(QKeySequence::Refresh); delayed_status.setInterval(150); /// \todo read from settings? delayed_status.setSingleShot(true); connect(&delayed_status, &QTimer::timeout, this, &ServerWidget::request_status); init_status_table(); init_cvar_table(); init_player_table(); init_console(); init_connection(); reload_settings(); }
void task_tty(void) { Tty *tty; init_console(); for (tty = tty_table ; tty < tty_table + TTY_NUM ; ++tty) { init_tty(tty); } select_tty(0); static int i=0; while(1) { //assert(0); //panic("in tty"); s32_print_int(i, (u8*)(0xb8000+160*23), 10); ++i; for (tty = tty_table ; tty < tty_table + TTY_NUM ; ++tty) { if (tty->ready == 1) { tty_do_read(tty); tty_do_write(tty); } } } }
/* * Retired functions. Use color.c functions instead. */ int Cputs (int attr, const char *buf) { static BOOL init = FALSE; int rc; if (use_colours && !init) { init_console(); atexit (exit_console); } init = TRUE; if (stdout_hnd == INVALID_HANDLE_VALUE) rc = fputs (buf, NORMAL_STREAM); else { DWORD written = 0; if (attr == 0) attr = csbi.wAttributes; else attr |= csbi.wAttributes & 0xF0; SetConsoleTextAttribute (stdout_hnd, attr); WriteConsole (stdout_hnd, buf, (DWORD)strlen(buf), &written, NULL); SetConsoleTextAttribute (stdout_hnd, csbi.wAttributes); rc = written; } return (rc); }
STATIC int boot_file(const char *device, const char *boot_from, int argc, char **argv, bool return_result) { char boot_from_path[PATH_MAX]; char filename[PATH_MAX]; char boot_filename[PATH_MAX]; sprintf(boot_from_path, "%s%s", device, boot_from); int init_fd = open(boot_from_path, O_RDONLY); int count = read(init_fd, boot_filename, sizeof(filename)); if (count <= 0) { init_console(); printf("Couldn't read '%s'\nerrno: %d", boot_from_path, errno); close(init_fd); fatal_error(false); return ERR_FILE_NOT_FOUND; } close(init_fd); char *newline = strchr(boot_filename, '\n'); if (newline) { *newline = '\0'; } else { newline = strchr(boot_filename, '\r'); if (newline) { *newline = '\0'; } } snprintf(filename, PATH_MAX, "%s%s", device, boot_filename); return run_file(filename, argc, argv, return_result); }
int main(int argc, char **args) { RAND = ((int)time(NULL))%10; init_console(); init_buffer(); init_clipboard(); if (argc > 1) { FILENAME = (unsigned char *)malloc(256*sizeof(char)); strcpy((char *)FILENAME, args[1]); file_to_buffer(); } else { MAX_VPOS = 1; } while (RUN) { redraw_screen(); #ifdef DEBUG_MODE printf("%d", INPUT_KEY); #endif INPUT_KEY = _getch(); process_key(); } DestroyAndExit("Exiting..."); return 0; }
static void doit (DDEV_REQ *packet) { switch (packet->header.msgtyp) { case DEV_OPN: /* デバイスのオープン */ if (!initialized) { init_console (); } open_console (packet->header.mbfid, &(packet->body.opn_req)); break; case DEV_CLS: /* デバイスのクローズ */ close_console (packet->header.mbfid, &(packet->body.cls_req)); break; case DEV_REA: read_console (packet->header.mbfid, &(packet->body.rea_req)); break; case DEV_WRI: write_console (packet->header.mbfid, &(packet->body.wri_req)); break; case DEV_CTL: control_console (packet->header.mbfid, &(packet->body.ctl_req)); break; } }
int printf(const char *format,...) { int i; int printed_simbols; va_list arg; char simbol[]={"%s"}; char *s; va_start(arg,format); if (console_init_status==0) { i=init_console(); console_init_status=1; } if (i==0) { s=malloc(4096); printed_simbols=format_print(s,4096,format,arg); con_printf(simbol,s); free(s); } return(printed_simbols); }
void init_screen(void) { int i; /* get video I/O port from BIOS */ if (in(VGA_MISC) & IS_COLOUR) { /* colour */ vid_port = CRTC_COLOUR; vid_memory = (unsigned short*) VID_COLOUR; nr_cons = COLOUR_SIZE / SCR_SIZE; } else { /* monochrome */ vid_port = CRTC_MONO; vid_memory = (unsigned short*) VID_MONO; nr_cons = MONO_SIZE / SCR_SIZE; } if (nr_cons > MAX_CONS) nr_cons = MAX_CONS; curcons = &cons_table[0]; /* select default console */ for (i = 0; i < nr_cons; i++) init_console(i); switch_console(0); /* switch to first console */ }
STATIC int execute_from_lexer(mp_lexer_t *lex, mp_parse_input_kind_t kind, bool repl) { if (lex == NULL) { init_console(); printf("MemoryError: lexer could not allocate memory\n"); return ERR_MEMORY_ALLOC; } nlr_buf_t nlr; if (nlr_push(&nlr) == 0) { qstr source_name = lex->source_name; if (kind == MP_PARSE_FILE_INPUT) { mp_store_global(MP_QSTR___file__, MP_OBJ_NEW_QSTR(source_name)); } mp_parse_tree_t parse_tree = mp_parse(lex, kind); mp_obj_t module_fun = mp_compile(&parse_tree, source_name, MP_EMIT_OPT_NONE, repl); mp_call_function_0(module_fun); if (MP_STATE_VM(mp_pending_exception) != MP_OBJ_NULL) { mp_obj_t obj = MP_STATE_VM(mp_pending_exception); MP_STATE_VM(mp_pending_exception) = MP_OBJ_NULL; nlr_raise(obj); } nlr_pop(); return 0; } else { if (mp_obj_exception_match(nlr.ret_val, &mp_type_SystemExit)) { return ERR_SYS_EXIT; } if (mp_obj_is_exception_type(nlr.ret_val) && ((mp_obj_exception_t *) nlr.ret_val)->args != NULL && ((mp_obj_exception_t *) nlr.ret_val)->args->len == 1) { int code = mp_obj_get_int(((mp_obj_exception_t *) nlr.ret_val)->args->items[0]); if (code == 0xDEAD0000) { return ERR_NETLOAD; } } init_console(); mp_obj_print_exception(&mp_plat_print, MP_OBJ_FROM_PTR(nlr.ret_val)); return ERR_PARSE; } }
STATIC int do_file(const char *file) { struct stat st; stat(file, &st); if (!S_ISREG(st.st_mode)) { init_console(); printf("Could not locate \"%s\"\n", file); return ERR_FILE_NOT_FOUND; } mp_lexer_t *lex = mp_lexer_new_from_file(file); return execute_from_lexer(lex, MP_PARSE_FILE_INPUT, false); }
int main(int argc, char** argv){ struct termios cfg, old; FILE* root = NULL; int gdbPort = 0; if(argc != 3 && argc != 2){ fprintf(stderr,"usage: %s path_to_disk [gdbPort]\n", argv[0]); return -1; } //setup the terminal { int ret; ret = tcgetattr(0, &old); cfg = old; if(ret) perror("cannot get term attrs"); #ifndef _DARWIN_ cfg.c_iflag &=~ (INLCR | INPCK | ISTRIP | IUCLC | IXANY | IXOFF | IXON); cfg.c_oflag &=~ (OPOST | OLCUC | ONLCR | OCRNL | ONOCR | ONLRET); cfg.c_lflag &=~ (ECHO | ECHOE | ECHONL | ICANON | IEXTEN | XCASE); #else cfmakeraw(&cfg); #endif ret = tcsetattr(0, TCSANOW, &cfg); if(ret) perror("cannot set term attrs"); } root = fopen64(argv[1], "r+b"); if(!root){ fprintf(stderr,"Failed to open root device\n"); exit(-1); } if(argc >= 3) gdbPort = atoi(argv[2]); start_mongoose(); init_console(); print_console(); //socInit(&soc, socRamModeAlloc, NULL, readchar, writechar, rootOps, root); socInit(&soc, socRamModeAlloc, NULL, get_one_keystroke, write_char_to_console, rootOps, root); signal(SIGINT, &ctl_cHandler); socRun(&soc, gdbPort); fclose(root); tcsetattr(0, TCSANOW, &old); 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"); }
int main(int argc, char *argv[]) { #ifdef DEBUG gtk_init(&argc, &argv); gtk_gl_init(&argc, &argv); #else gtk_init(NULL, NULL); gtk_gl_init(NULL, NULL); #endif setup_splash(); splash("Starting up..."); // Init logfile FILE* f = fopen("slade.log", "wt"); fclose(f); load_main_config(); init_console(); setup_icons(); log_message("Init textures...\n"); init_textures(); log_message("Loading colour configurations...\n"); load_colour_configs(); string ccfg = col_config; set_colour_config(ccfg); log_message("Setup editor window...\n"); setup_editor_window(); log_message("Setup wad manager window...\n"); splash_hide(); setup_main_window(); log_message("Init OK.\n"); open_main_window(); // Setup gl font //font_list = glGenLists(256); //PangoFontDescription *font_desc = pango_font_description_from_string("Monospace 10"); //gdk_gl_font_use_pango_font(font_desc, 0, 255, font_list); gtk_main(); save_main_config(); return 0; }
/* __al_linux_use_console: * Init Linux console if not initialized yet. */ int __al_linux_use_console(void) { console_users++; if (console_users > 1) return 0; if (init_console()) { console_users--; return 1; } /* Initialise the console switching system */ set_display_switch_mode (SWITCH_PAUSE); return __al_linux_init_vtswitch(); }
static pid_t run_shell(int timeout, int nowait) { pid_t pid; char tz[128]; char *envp[] = { "TERM=" CONSOLE_TERMINAL, "TERMINFO=/usr/share/terminfo", "PATH=" SYS_EXEC_PATH, "SHELL=" SYS_SHELL, "USER="******"HOME=" INIT_HOME_PATH, tz, NULL }; /* Wait for user input */ // if (waitfor (STDIN_FILENO, timeout) <= 0) // return 0; switch ((pid = fork())) { case -1: perror("fork"); return 0; case 0: /* Reset signal handlers set for parent process */ reset_signals(); /* Reopen console */ init_console(); /* Pass on TZ */ time_zone_x_mapping(); snprintf(tz, sizeof(tz), "TZ=%s", nvram_safe_get("time_zone_x")); /* Now run it. The new program will take over this PID, * so nothing further in init.c should be run. */ execve(SYS_SHELL, (char *[]) { SYS_SHELL, NULL }, envp); /* We're still here? Some error happened. */ perror(SYS_SHELL); exit(errno); default: if (nowait) return pid; else { waitpid(pid, NULL, 0); return 0; } }
int main(long fwhandle,long evector,long fwentry,long fwseal) { struct stat sb; const char *reason; int fd; /* Init prom callback vector. */ cfe_init(fwhandle,fwentry); init_console(); putstr("\nNetBSD/sbmips " NETBSD_VERS " " BOOTXX_FS_NAME " Primary Bootstrap\n"); if (!booted_dev_open()) { reason = "Can't open boot device."; goto fail; } fd = open("boot", 0); if (fd == -1 || (fstat(fd, &sb) == -1)) { reason = "Can't open /boot."; goto failclose; } if (sb.st_size > SECONDARY_MAX_LOAD) { reason = "/boot too large."; goto failclose; } if (read(fd, (void*)SECONDARY_LOAD_ADDRESS, sb.st_size) != sb.st_size) { reason = "/boot load failed."; goto failclose; } cfe_flushcache(0); putstr("Jumping to entry point...\n"); (*((void(*)(long,long,long))SECONDARY_LOAD_ADDRESS))(fwhandle,booted_dev_fd,fwentry); reason = "Secondary boot returned!"; failclose: booted_dev_close(); fail: putstr(reason); putstr("\n\nPRIMARY BOOTSTRAP FAILED!\n"); return 1; }
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 }
int main(const int argc, const char *argv[]) { char version_string[256]; static struct s_hardware hardware; snprintf(version_string, sizeof version_string, "%s %s (%s)", PRODUCT_NAME, VERSION, CODENAME); /* Cleaning structures */ init_hardware(&hardware); /* Detecting Syslinux version */ detect_syslinux(&hardware); /* Detecting parameters */ detect_parameters(argc, argv, &hardware); /* Opening the Syslinux console */ init_console(&hardware); /* Detect hardware */ detect_hardware(&hardware); /* Clear the screen and reset position of the cursor */ clear_screen(); printf("\033[1;1H"); more_printf("%s\n", version_string); int return_code = 0; if (!menumode || automode) start_cli_mode(&hardware); else { return_code = start_menu_mode(&hardware, version_string); if (return_code == HDT_RETURN_TO_CLI) start_cli_mode(&hardware); } /* Do we got request to do something at exit time ? */ if (strlen(hardware.postexec)>0) { more_printf("Executing postexec instructions : %s\n",hardware.postexec); runsyslinuxcmd(hardware.postexec); } return return_code; }
/* * console デバイスドライバの main 関数 * * この関数は、デバイスドライバ立ち上げ時に一回だけ実行する。 * */ start () { extern char version[]; /* * 要求受信用のポートの作成 */ init_console (); /* * 立ち上げメッセージ */ dbg_printf ("console driver start\n"); dbg_printf (" receive port is %d\n", recvport); main_loop (); }
//Currently, kmain uses the interrupt stack. //It might overwrite ATAGs, etc. if care is not used. //TODO: allocate a stack elsewhere? void kmain(KMAIN_ARGS) { get_memory_map(); map_io_area(); bool status = init_console(); if(status) { init_phys_allocators(); //Drivers must be loaded before any heap allocations //because driver images are stored at the beginning of the heap. load_drivers(); interrupt_init(); enable_irqs(); //enable_irq(cpu_timer); } else { //To do: error handling. } }
void start_kernel(void) { seg_t base, end; /* We set the idle task as #0, and init_task() will be task #1 */ sched_init(); /* This block of functions don't need console */ setup_arch(&base, &end); mm_init(base, end); buffer_init(); inode_init(); init_IRQ(); tty_init(); init_console(); #if (CONFIG_BOGOMIPS == 0) calibrate_delay(); #endif device_setup(); #ifdef CONFIG_SOCKET sock_init(); #endif fs_init(); mm_stat(base, end); printk("ELKS version %s\n", system_utsname.release); kfork_proc(init_task); wake_up_process(&task[1]); /* * We are now the idle task. We won't run unless no other process can run. */ while (1) { schedule(); #ifdef CONFIG_IDLE_HALT idle_halt (); #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 vir_machine_init() { init_log_record(); init_console(); init_display_mem(); open_disk(); /** * initialize cpu */ int i; for (i = 0; i < CPU_REG_NUM; i++) R[i] = 0; memory = (mem_word *)malloc(sizeof(mem_word) * MEM_SIZE); /** * TODO ! * INITIAL CP0 * CP0[32]... */ }
void start_kernel(void) { seg_t base, end; /* We set the scheduler up as task #0, and this as task #1 */ setup_arch(&base, &end); mm_init(base, end); init_IRQ(); init_console(); #if 0 calibrate_delay(); #endif setup_mm(); /* Architecture specifics */ tty_init(); buffer_init(); #ifdef CONFIG_SOCKET sock_init(); #endif device_setup(); inode_init(); fs_init(); sched_init(); printk("ELKS version %s\n", system_utsname.release); task[0].t_kstackm = KSTACK_MAGIC; task[0].next_run = task[0].prev_run = &task[0]; kfork_proc(&task[1], init_task); /* * We are now the idle task. We won't run unless no other process can run. */ while (1){ schedule(); } }
int main(int argc, char *argv[]) { float x; argc; argv; // shut compiler up init_console(); printf("Hello Z80 C world! int %d string %s hex %x\r\n\r\n", 1, "haha", 0xff); x = 0; do { space((int)(40+sinf(x)*20)); printf("*\r\n"); x += 0.2; } while (x <= 6.2); return (0); }
int CRobotBodyManager::Init() { int ret; init_console(); ret = uart_open(); if (ret < 0) { //uart 연결 실패시 printf("FAIL : UART \n"); } uart_config(UART1, 115200, 8, UART_PARNONE, 1); //uart 채널 설정 m_pStateManager->Init(); //state manager 초기화 CMessageCommManager::GetSingleton()->Connect(COMM_TYPE_ROT_TO_MGR); // rot -> mgr 파이프 연결 CMessageCommManager::GetSingleton()->Connect(COMM_TYPE_MGR_TO_ROT); // mgr -> rot 파이프 연결 CRobotControlManager::GetSingleton()->Init(); //robot control manager 초기화 m_pTimeManager->Init(); //timer manager 초기화 return 0; }
static struct platform *zynq_platform_setup(void *param) { smp_init_cpus(1); zynq_cpu1_init(); zynq_memory_init(); zynq_uart_init(); #ifdef TEST init_console(); printk("Hello World\n"); #endif zynq_irq_init(); zynq_timer_init(); return &platform_zynq; }
int main(const int argc, const char *argv[]) { char version_string[256]; const char *arg; struct s_hardware hardware; snprintf(version_string, sizeof version_string, "%s %s (%s)", PRODUCT_NAME, VERSION, CODENAME); /* Cleaning structures */ init_hardware(&hardware); /* Detecting Syslinux version */ detect_syslinux(&hardware); /* Detecting parameters */ detect_parameters(argc, argv, &hardware); /* Opening the Syslinux console */ init_console(&hardware); /* Clear the screen and reset position of the cursor */ clear_screen(); printf("\033[1;1H"); printf("%s\n", version_string); if ((arg = find_argument(argv + 1, "nomenu")) || (find_argument(argv + 1, "auto"))) start_cli_mode(&hardware); else { int return_code = start_menu_mode(&hardware, version_string); if (return_code == HDT_RETURN_TO_CLI) start_cli_mode(&hardware); else return return_code; } return 0; }
int main(int argc, char *argv[]) { gtk_init(&argc, &argv); setup_splash(); splash("Starting up..."); //gtk_gl_init(&argc, &argv); // Init logfile FILE* f = fopen("slade.log", "wt"); fclose(f); load_main_config(); init_console(); setup_icons(); init_textures(); load_colour_configs(); string ccfg = col_config; set_colour_config(ccfg); setup_editor_window(); setup_main_window(); open_main_window(); // Setup gl font //font_list = glGenLists(256); //PangoFontDescription *font_desc = pango_font_description_from_string("Monospace 10"); //gdk_gl_font_use_pango_font(font_desc, 0, 255, font_list); splash_hide(); gtk_main(); save_main_config(); return 0; }