コード例 #1
0
ファイル: mpos-kern.c プロジェクト: sths0614/CS111-weensyos1
void
start(void)
{
	const char *s;
	int whichprocess;
	pid_t i;

	// Initialize process descriptors as empty
	memset(proc_array, 0, sizeof(proc_array));
	for (i = 0; i < NPROCS; i++) {
		proc_array[i].p_pid = i;
		proc_array[i].p_state = P_EMPTY;
	}

	// The first process has process ID 1.
	current = &proc_array[1];

	// Set up x86 hardware, and initialize the first process's
	// special registers.  This only needs to be done once, at boot time.
	// All other processes' special registers can be copied from the
	// first process.
	segments_init();
	special_registers_init(current);

	// Erase the console, and initialize the cursor-position shared
	// variable to point to its upper left.
	console_clear();

	// Figure out which program to run.
	
	cursorpos = console_printf(cursorpos, 0x0700, "Type '1' to run mpos-app, or '2' to run mpos-app2.");
	do {
		whichprocess = console_read_digit();
	} while (whichprocess != 1 && whichprocess != 2);
	console_clear();
	

	// Load the process application code and data into memory.
	// Store its entry point into the first process's EIP
	// (instruction pointer).
	program_loader(whichprocess - 1, &current->p_registers.reg_eip);

	// Set the main process's stack pointer, ESP.
	current->p_registers.reg_esp = PROC1_STACK_ADDR + PROC_STACK_SIZE;

	// Mark the process as runnable!
	current->p_state = P_RUNNABLE;

	// Switch to the main process using run().
	run(current);
}
コード例 #2
0
ファイル: console.c プロジェクト: m-rinaldi/kboot86
// returns zero if char must not be echoed on the screen
static inline
int _putc(char c, bool display)
{
    switch (c) {
        case '\n':
            _line_feed();
            break;

        case '\t':
            _tab();
            break;

        case '\r':
            _kill();
            break;

        case 127:
            console_clear();
            break;

        case '\b':
            _del_ibuf();
            break;

        default:
            // not a control character
            if (display)
                _putc_attr(c, _.attr);
            return 1;
    }
    return 0;
}
コード例 #3
0
ファイル: erasure_tool.c プロジェクト: baleh1/k-os
void erasure_tool_run() {
    keyboard_register_key_down(handle_down);

    console_clear();
    console_puts("Welcome to K-OS!\n\nCopyright (c) 2013 Keeley Hoek\nAll rights reserved.\n\n");

    console_puts("THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND\n");
    console_puts("ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n");
    console_puts("WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n");
    console_puts("DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR\n");
    console_puts("ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n");
    console_puts("(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n");
    console_puts("LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n");
    console_puts("ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n");
    console_puts("(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n");
    console_puts("SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n");

    console_puts("\n\n\n\n\n\n\n");
    console_puts("If you do not agree to the above terms TURN THE COMPUTER OFF NOW.\n");
    console_puts("If you do agree to the above terms press enter to continue.");

    beep();

    wait_for_enter();

    main_menu();
}
コード例 #4
0
ファイル: entry.c プロジェクト: ygoogole/yos
int kern_entry()
{
    init_debug();

    console_clear();

    printk_color(rc_black, rc_green, "Hello, OS kernel!\n");

    //panic("test");

	printk("kernel in memory start: 0x%08X\n", kern_start);
	printk("kernel in memory end:   0x%08X\n", kern_end);
	printk("kernel in memory used:   %d KB\n\n", (kern_end - kern_start) / 1024);
	
	show_memory_map();
	init_pmm();

	printk_color(rc_black, rc_red, "\nThe Count of Physical Memory Page is: %u\n\n", phy_page_count);

	uint32_t allc_addr = NULL;
	printk_color(rc_black, rc_light_brown, "Test Physical Memory Alloc :\n");
	allc_addr = pmm_alloc_page();
	printk_color(rc_black, rc_light_brown, "Alloc Physical Addr: 0x%08X\n", allc_addr);
	allc_addr = pmm_alloc_page();
	printk_color(rc_black, rc_light_brown, "Alloc Physical Addr: 0x%08X\n", allc_addr);
	allc_addr = pmm_alloc_page();
	printk_color(rc_black, rc_light_brown, "Alloc Physical Addr: 0x%08X\n", allc_addr);
	allc_addr = pmm_alloc_page();
	printk_color(rc_black, rc_light_brown, "Alloc Physical Addr: 0x%08X\n", allc_addr);

    return 0;
}
コード例 #5
0
ファイル: display_c.cpp プロジェクト: NHHSBotball/libwallaby
// Usage: same as printf except the first two parameters specify
//    the (column, row) of the display where print is to begin.
// Excess print to a line is truncated.
void display_printf(int col, int row, const char *t, ...) { //  variadic function
	va_list argp;       // variadic argument list pointer for vsprintf
	int i, maxw;        // maxw marks available room on row
	int rb6=__VBUTTONS; // row adjustment (default is 2, if there are no buttons, change to 0)
	char *dp, ws[256];  // pointer into display map, working string for vsprintf

	va_start (argp,t);  // t is last named argument in display_printf's function header;
	// Note: system macro va_start points argp to first variadic arg for vsprintf
	if (get_extra_buttons_visible()) rb6=4;
	if (col >= _MAPx) {row = row+1; col = 0;} // bad col so wrap to next line
	if (row >= _MAPy) row = _MAPy - 1;        // bad row so (over) print on last line
	console_clear();               // ready the display
	if (_initialize_ == 1) {display_clear(); _initialize_=0;} // clear map to spaces on first call
	dp = &_display_map[row][col];  // starting point for printf
	maxw=_MAPx - col - 1;          // space remaining on line
	vsprintf(ws, t, argp);         // same as sprintf except requires a pointer to argument list
	for(i=0; i<strlen(ws); i++) {  // insert formatted phrase in display map
		if (maxw==0) break;         // if no more room get out of this
		*dp = ws[i];                // insert next character from working string
		dp++; maxw--;
	}
	va_end(argp);                  // clean up
	for(i=0; i< _MAPy-rb6-1; i++) printf("%s\n",_display_map[i]); // refresh the display
	printf("%s",_display_map[i]);  // last line printed without new line
}
コード例 #6
0
ファイル: screen.c プロジェクト: pratikmankawde/HelenOS_Nano
/*
 * Clear the screen, forgetting the current contents in the process.
 */
void scr_clear(void)
{
	resume_normal();
	console_clear(console);
	curscore = -1;
	memset(curscreen, 0, sizeof(curscreen));
}
コード例 #7
0
ファイル: kbd.c プロジェクト: emlyn/chdk
// remote autostart
void script_autostart()
{
    kbd_blocked = 1;
    gui_kbd_enter();
    console_clear();
    script_console_add_line("***Autostart***"); //lang_str(LANG_CONSOLE_TEXT_STARTED));
    script_start_gui( 1 );
}
コード例 #8
0
ファイル: schedos-kern.c プロジェクト: summerxuan/cs111
void
start(void)
{
	int i;

	// Set up hardware (schedos-x86.c)
	segments_init();
	interrupt_controller_init(0);
	console_clear();

	// Initialize process descriptors as empty
	memset(proc_array, 0, sizeof(proc_array));
	for (i = 0; i < NPROCS; i++) {
		proc_array[i].p_pid = i;
		proc_array[i].p_state = P_EMPTY;
	}

	// Set up process descriptors (the proc_array[])
	queue_t frontground = initQueue();
	queue_t background = initQueue();
	for (i = 1; i < NPROCS; i++) {
		process_t *proc = &proc_array[i];
		uint32_t stack_ptr = PROC1_START + i * PROC_SIZE;

		// Initialize the process descriptor
		special_registers_init(proc);

		// Set ESP
		proc->p_registers.reg_esp = stack_ptr;

		// Load process and set EIP, based on ELF image
		program_loader(i - 1, &proc->p_registers.reg_eip);

		// Mark the process as runnable!
		proc->p_state = P_RUNNABLE;
	}

	// Initialize the cursor-position shared variable to point to the
	// console's first character (the upper left).
	cursorpos = (uint16_t *) 0xB8000;

	// Initialize the scheduling algorithm.
	// USE THE FOLLOWING VALUES:
	//    0 = the initial algorithm
	//    2 = strict priority scheduling (exercise 2)
	//   41 = p_priority algorithm (exercise 4.a)
	//   42 = p_share algorithm (exercise 4.b)
	//    7 = any algorithm that you may implement for exercise 7
	scheduling_algorithm = 7;

	// Switch to the first process.
	run(&proc_array[1]);

	// Should never get here!
	while (1)
		/* do nothing */;
}
コード例 #9
0
ファイル: main.c プロジェクト: zrho/Carbon
int init(uint32_t mboot_magic, multiboot_info_t *mboot_info) {
    // Header
    console_clear();
    DEBUG("------------------------------------------\n");
    DEBUG("Welcome to Hydrogen AMD64 Loader 0.1\n");
    DEBUG("Copyright (c) 2011 by Lukas Heidemann\n");
    DEBUG("------------------------------------------\n");

    // Check multiboot magic
    if (mboot_magic != MULTIBOOT_BOOTLOADER_MAGIC)
        PANIC("Bad multiboot magic value supplied by bootloader.\n"
            "Please make sure, that your bootloader implements the Multiboot specification"
            " in version 1 or higher.");

    // Parse boot info and relocate modules
    boot_info_t *info = boot_info_parse(mboot_info);
    frame_placement = memalign(boot_modules_relocate(info, (uintptr_t) &end), 0x1000);
    boot_modules_map(info);

    DEBUG("Boot loader name: ");
    DEBUG((int8_t *) (uintptr_t) info->loader_name);
    DEBUG("\nLoader arguments: ");
    DEBUG((int8_t *) (uintptr_t) mboot_info->cmdline);
    DEBUG("\n");

    // Find the kernel module
    boot_info_mod_t *kernel_mod = _boot_find_kernel(info);

    if (0 == kernel_mod)
        PANIC("Could not find kernel binary.\n"
            "The Hydrogen AMD64 loader expects an ELF64 kernel binary to be given as a "
	        "module with the name '/boot/kernel.bin'. Please make sure that your kernel "
	        "binary is named as such and is passed by the bootloader.");

    // Map system structures
    memory_map_system(info);

    // Load the kernel
    uint16_t pflags = PAGE_FLAG_GLOBAL;
    info->entry_point = binary_load_elf64((void *) (uintptr_t) kernel_mod->address, pflags);

    DEBUG("Kernel Entry Point: ");
    DEBUG_HEX(info->entry_point);
    DEBUG("\n");

    // Set beginning of free memory
    info->free_mem_begin = memalign(frame_placement, 0x1000);

    // Prepare long mode trampoline code
    boot_trampoline_callback = info->entry_point;

    // Relocate info structure to higher half
    boot_info_relocate(info, MEMORY_BOOT_INFO_VADDR);
    
    return 0;
}
コード例 #10
0
ファイル: erasure_tool.c プロジェクト: baleh1/k-os
static void print_header() {
    console_clear();

    console_puts("Welcome to the K-OS Secure Data Erasure Tool!\n\nCopyright (c) 2013 Keeley Hoek\nAll rights reserved.\n\n");

    console_color(0x0C);
    console_puts("WARNING: ");
    console_color(0x07);
    console_puts("This software irreversably and indescriminatley destroys data.\n\n");
}
コード例 #11
0
ファイル: kernel.c プロジェクト: phillid/toast
void kernel_main(multiboot_info_t *mbd, uint32_t magic)
{
	//*********************************************************
	// First things first. Parse the command line. Quick guide:
	//
	//  o quiet  - Don't print so much stuff to the screen during boot
	//  o silent - Don't print anything at all during boot (implies quiet)
	//  o eshell - (RESERVED) Will be used to enter emergency shell
	//
	if (string_contains( (char*)(mbd->cmdline) , "quiet"))
		KERNEL_OPTION_QUIET = TRUE;

	if (string_contains( (char*)(mbd->cmdline) , "silent"))
	{
		KERNEL_OPTION_QUIET = TRUE;
		KERNEL_OPTION_SILENT = TRUE;
	}
	if (string_contains( (char*)(mbd->cmdline) , "eshell"))
		KERNEL_OPTION_ESHELL = TRUE;
	//*********************************************************

	//*********************************************************
	// Do some important things before we forget
	k_tally_available_memory(mbd);

	// Init the text console and colours
	console_init();
	console_set_colors(COLOR_BRIGHT_GRAY, COLOR_BLACK);
	console_swap_colors();
	console_set_colors(COLOR_BRIGHT_GRAY, COLOR_BLACK);
	console_clear();
	//*********************************************************

	if (!KERNEL_OPTION_QUIET)
	{
		// Print some stuff about the environment
		console_print("Here is kernel_main()\n");
		console_print("Bootloader: %s\n",mbd->boot_loader_name);
		console_print("Kernel: %s\n",mbd->cmdline);
		console_print("Flags: %b\n",mbd->flags);
		console_print("Boot Device: %x\n",mbd->boot_device);

		// Dump some info about the memory blocks/regions available/reserved
		k_dump_memory_blocks(mbd);
	}
	if (!KERNEL_OPTION_SILENT)
	{
		console_print("Welcome to Toast v%d.%d (nickname '%s')\nMemory: %dMiB",
						KERNEL_VERSION_MAJ,
						KERNEL_VERSION_MIN,
						KERNEL_NICKNAME,
						TOTAL_MEMORY/1048576);
	}
	//panic(0x4655434B); // (TEST) testing panic
}
コード例 #12
0
ファイル: schedos-kern.c プロジェクト: akhahaha/weensy-os2
void
start(void)
{
	int i;

	// Set up hardware (schedos-x86.c)
	segments_init();
	interrupt_controller_init(1);
	console_clear();

	// Initialize process descriptors as empty
	memset(proc_array, 0, sizeof(proc_array));
	for (i = 0; i < NPROCS; i++) {
		proc_array[i].p_pid = i;
		proc_array[i].p_state = P_EMPTY;
	}

	// Set up process descriptors (the proc_array[])
	for (i = 1; i < NPROCS; i++) {
		process_t *proc = &proc_array[i];
		uint32_t stack_ptr = PROC1_START + i * PROC_SIZE;

		// Initialize proportional scheduling vars
		proc->p_share = 1;
		proc->p_run_t = 0;

		// Initialize the process descriptor
		special_registers_init(proc);

		// Set ESP
		proc->p_registers.reg_esp = stack_ptr;

		// Load process and set EIP, based on ELF image
		program_loader(i - 1, &proc->p_registers.reg_eip);

		// Mark the process as runnable!
		proc->p_state = P_RUNNABLE;
	}

	// Initialize the cursor-position shared variable to point to the
	// console's first character (the upper left).
	cursorpos = (uint16_t *) 0xB8000;

	// Initialize the scheduling algorithm.
	scheduling_algorithm = 0;

	// Switch to the first process.
	run(&proc_array[1]);

	// Should never get here!
	while (1)
		/* do nothing */;
}
コード例 #13
0
ファイル: console.c プロジェクト: phoyd/avr-teletext
void console_setup()
{

  /* In console mode the buffer is used like a text console.
     Scrolling is implemented by changing the line numbers
     in each packet. The whole buffer is sent repeatedly. */

  tt_buffer[0][0] = 0x2;
  tt_buffer[0][1] = 0x15;
  tt_buffer[0][2] = 0x15;
  tt_buffer[0][3] = 0x15;
  tt_buffer[0][4] = 0x15;
  tt_buffer[0][5] = 0x15;
  tt_buffer[0][6] = 0x15;
  tt_buffer[0][7] = 0x15;
  tt_buffer[0][8] = 0x15;
  tt_buffer[0][9] = 0x15;
  tt_buffer[0][10] = parity('A');
  tt_buffer[0][11] = parity('V');
  tt_buffer[0][12] = parity('R');
  tt_buffer[0][13] = parity(' ');
  tt_buffer[0][14] = parity('T');
  tt_buffer[0][15] = parity('e');
  tt_buffer[0][16] = parity('x');
  tt_buffer[0][17] = parity('t');
  tt_buffer[0][18] = 0x20;
  tt_buffer[0][19] = 0x31;
  tt_buffer[0][20] = 0xb0;
  tt_buffer[0][21] = 0xb0;
  tt_buffer[0][22] = 0x20;
  tt_buffer[0][23] = 0x54;
  tt_buffer[0][24] = 0x75;
  tt_buffer[0][25] = 0xe5;
  tt_buffer[0][26] = 0x20;
  tt_buffer[0][27] = 0x31;
  tt_buffer[0][28] = 0x37;
  tt_buffer[0][29] = 0x20;
  tt_buffer[0][30] = 0x4a;
  tt_buffer[0][31] = 0x61;
  tt_buffer[0][32] = 0x6e;
  tt_buffer[0][33] = 0x83;
  tt_buffer[0][34] = 0x32;
  tt_buffer[0][35] = 0x31;
  tt_buffer[0][36] = 0xba;
  tt_buffer[0][37] = 0xb5;
  tt_buffer[0][38] = 0xb0;
  tt_buffer[0][39] = 0x2f;
  tt_buffer[0][40] = 0xb3;
  tt_buffer[0][41] = 0xb6;

  console_clear();
  buffer_head = NBUFFERS; // Will never be reached.
}
コード例 #14
0
ファイル: entry.c プロジェクト: Andiry/hurlex-doc
int kern_entry()
{
	init_debug();

	console_clear();

	printk_color(rc_black, rc_green, "Hello, OS kernel!\n");

	panic("test");

	return 0;
}
コード例 #15
0
ファイル: mddi_console.c プロジェクト: ashang/boot_tools
void console_init(void)
{
    mddi_init();

    cmaxx = fb_width / 6;
    cmaxy = (fb_height-1) / 12;
    cx = 0;
    cy = 0;

    console_clear();
    console_flush();
}
コード例 #16
0
ファイル: module_load.c プロジェクト: c10ud/CHDK
//-----------------------------------------------
// Display module load/unload error message on console
static void moduleload_error(const char* name, const char* text)
{
    extern volatile int chdk_started_flag;
    if (chdk_started_flag)
    {
        char buf[100];
        sprintf(buf, "Fail to load %s: %s", name, text);

        console_clear();
        console_add_line(buf);
        msleep(1000);
    }
}
コード例 #17
0
ファイル: console.cpp プロジェクト: cpehle/NyuziProcessor
void console_init(void *base_address, unsigned int width, unsigned int height)
{
    frame_buffer = static_cast<unsigned int*>(base_address);
    fb_width = width;
    fb_height = height;
    num_cols = width / GLYPH_WIDTH;
    num_rows = height / (GLYPH_HEIGHT * 2);
    bg_color = 0;
    fg_color = 0xffffffff;
    current_col = 0;
    current_row = 0;
    console_clear();
}
コード例 #18
0
ファイル: console.c プロジェクト: DragonMinded/libdragon
/**
 * @brief Initialize the console
 *
 * Initialize the console system.  This will initialize the video properly, so
 * a call to the display_init() fuction is not necessary.
 */
void console_init()
{
    /* In case they initialized the display already */
    display_close();
    display_init( RESOLUTION_320x240, DEPTH_16_BPP, 2, GAMMA_NONE, ANTIALIAS_RESAMPLE );

    render_buffer = malloc(CONSOLE_SIZE);

    console_clear();
    console_set_render_mode(RENDER_AUTOMATIC);

    /* Register ourselves with newlib */
    hook_stdio_calls( &console_calls );
}
コード例 #19
0
ファイル: console.c プロジェクト: frantony/magic-lantern
static void console_init()
{
    console_clear();

    #ifdef CONSOLE_DEBUG
    menu_add( "Debug", script_menu, COUNT(script_menu) );

	msleep(500);

	if (!console_log_file) {
	    console_log_file = FIO_CreateFileEx(CARD_DRIVE "ML/LOGS/console.log");
	}
    #endif
}
コード例 #20
0
ファイル: tcc-gui.c プロジェクト: frantony/magic-lantern
static void run_script(const char *script)
{
    extern int ml_started;
    while (!ml_started) msleep(100); // for startup scripts

    script_state = SCRIPT_RUNNING;

    msleep(500);
    
    console_clear();
    console_show();
    console_set_help_text("SET: show/hide");
    console_set_status_text("Script running...");
    
    int exit_code = tcc_compile_and_run(get_script_path(script_selected));
    if (exit_code == 0)
    {
        console_puts(    "Script finished.\n");
    }
    else
    {
        console_printf(  "Script error: %d.\n", exit_code);
        msleep(500);
        gui_stop_menu();
        msleep(500);
        console_show();
    }
    
    // restore some settings to normal, if script changed them
    //~ script_cleanup_af();
    bmp_draw_to_idle(0);
    canon_gui_enable_front_buffer(0);
    
    beep();
    script_state = SCRIPT_JUST_FINISHED;
    console_set_status_text("Script finished. ");
    msleep(500);
    redraw();
    msleep(500);
    for (int i = 0; i < 100; i++)
    {
        msleep(100);
        if (gui_menu_shown()) break;
        if (get_halfshutter_pressed()) break;
    }
    console_hide();
    script_state = SCRIPT_IDLE;
    console_set_status_text("");
}
コード例 #21
0
ファイル: console.c プロジェクト: m-rinaldi/kboot86
int console_init(void)
{
    _.attr = ATTR_GREEN_ON_BLACK;
    _.curs_x = _.curs_y = 0;    

    _.line_completed = false;
    _.widx = 0;

    console_clear();

    if (keyboard_init())
        return 1;

    return 0;
}
コード例 #22
0
ファイル: console.c プロジェクト: bmarcot/kemerald
int32_t	console_init(void)
{
    uint32_t	i = 0;

    /* reset column and line to 0 */
    g_console_column = g_console_line = 0;

    /* init static and global variable */
    console_lastline = 0;

    console_clear();
    for (i = 1; i < CONSOLE_VIDEO_BUFFER_S; i+=2)
        g_console_video[i] = FG_WHITE | BG_BLACK | FG_INTENSITY;

    return ERR_NONE;
}
コード例 #23
0
ファイル: entry.c プロジェクト: HiWong/hurlex-doc
int kern_entry()
{
    init_debug();
    init_gdt();
    init_idt();

    console_clear();
    printk_color(rc_black, rc_green, "Hello, OS kernel!\n");

    init_timer(200);

    // 开启中断
    asm volatile ("sti");

    return 0;
}
コード例 #24
0
ファイル: command.c プロジェクト: cnvogelg/knobterm
static u08 cmd_erase(const u08 *cmd, u08 len)
{
  if(len > 2) {
    return CMD_SYNTAX_ERR;
  }
  
  u08 col = 0;
  if(len == 2) {
    if(!parse_nybble(cmd[1],&col)) {
      return CMD_NO_NYBBLE;
    }
  }
  
  console_t *c = console_get_current();
  console_clear(c, col);
  
  return CMD_OK;
}
コード例 #25
0
ファイル: main.c プロジェクト: antoniovillena/zxuno
void load_rom(file_descr_t *entry)
{
	file_t file;
	int i;
	DWORD size;

	console_clear();
	console_puts("Loading ");
	for (i=0; i<8; i++) {
		console_putc(entry->name[i]);
	}
	console_putc('.');
	for (i=8; i<11; i++) {
		console_putc(entry->name[i]);
	}
	console_puts("\n\n");

	fat_open_file(&file, entry->cluster);
	size = 0;
	while (1) {
		UBYTE* data;
		if ((size&0x3fff)==0) {
			// switch page 1
			*((UBYTE*)0xffff) = (size>>14)&0xff;
		}
		// write to page 2
		data = 0x8000+(size&0x3fff);
		data = fat_load_file_sector(&file,data);
		if (data==0) {
			console_puts("Error while reading file\n");
		} else if (data==FAT_EOF) {
			console_gotoxy(0,2);
			return;
		} else {
			// process data
			size += 0x200;
			if ((size)%16384 == 0)
			   console_puts(".");
			//console_gotoxy(0,3);
			//console_print_dword(size);
			//console_puts(" bytes loaded");
		}
	}
コード例 #26
0
ファイル: airstrike.c プロジェクト: xdzhou/Airstrike
/* choices is null terminated. Return the
 index of the choosen item, or -1 if escape was
 pressed.*/
int select_mode(char *header, char *choices[])
{
	int i, key, choice = 0;
	while (1)
	{
		console_clear();
		console_write(header);
		console_write("\n");
		for (i = 0; choices[i]; i++)
		{
			if (choice == i)
				console_write("*");
			else
				console_write(" ");
			console_write(choices[i]);
			console_write("\n");
		}
		console_frame();
		key = wait_for_key();
		switch (key)
		{
		case SDLK_UP:
			choice--;
			if (choice < 0)
			{
				/* seek last item */
				choice = 0;
				while (choices[choice + 1] != 0)
					choice++;
			}
			break;
		case SDLK_DOWN:
			choice++;
			if (choices[choice] == 0)
				choice = 0;
			break;
		case SDLK_ESCAPE:
			return -1;
		default:
			return choice;
		}
	}
}
コード例 #27
0
ファイル: playback.c プロジェクト: yogpstop/MyGCCProj
THREAD_RAC play_thread(void *arg) {
	void *handle;
	snd__(init, &handle);
	size_t remain, done, cur_id = 0;
	void *ptr;
	pcm *str = arg;
	volatile unsigned char *sync = str->update + cur_id;
	while (!*sync);
	*sync = 0;
	MUTEX_LOCK(str->mutex + cur_id);
	while(1) {
		remain = str->period;
		ptr = str->buf + cur_id * str->period * CHANNELS * BITS / 8;
		if (str->update[cur_id]) {
			console_clear();
#ifdef _WIN32
			SetConsoleTitleA(str->name);
#else
			fputs("\e]0;", stdout);
			fputs(str->name, stdout);
			fputs("\a", stdout);
#endif
			fputs("Now playing... ", stdout);
			fputs(str->name, stdout);
			fputc('\n', stdout);
			free(str->name); str->name = NULL;
			str->update[cur_id] = 0;
		}
		while(remain > 0) {
			if(exit_signal) break;//TODO
			done = snd__(write, handle, ptr, remain);
			if(done < 0) continue;
			ptr += done * CHANNELS * BITS / 8;
			remain -= done;
		}
		exit_signal = 0;//TODO
		if(force_exit_signal) break;
		cur_id++;
		cur_id = cur_id & str->buf_max;
		MUTEX_LOCK(str->mutex + cur_id);
		MUTEX_UNLOCK(str->mutex + ((cur_id - 1) & str->buf_max));
	}
コード例 #28
0
ファイル: init.c プロジェクト: liexusong/tiny-os
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");
	}
}
コード例 #29
0
ファイル: command.c プロジェクト: hhirsch/goblinhack2
static void console_refresh (void)
{
    if (!HEADLESS && !enable_console) {
        return;
    }

    static char tmp[MAXSTR];
    static char cursor_char[2] = { '_', '\0' };

    strlcpy(tmp, wid_text, cursor_x + 1);
    strlcat(tmp, cursor_char, sizeof(tmp));
    strlcat(tmp, wid_text + cursor_x, sizeof(tmp));

    console_clear();

    term_goto(0, TERM_HEIGHT - 1);
    term_putf("gorynlich> ");
    term_putf(tmp);
    term_putf(" ");
    term_refresh();
}
コード例 #30
0
ファイル: erasure_tool.c プロジェクト: baleh1/k-os
static void print_tech_info() {
    console_clear();
    print_header();

    console_color(0x0E);
    console_puts("Technical Information\n");
    console_color(0x07);

    console_puts("The K-OS Secure Data Erasure Tool works by repeatadly writing over the contents of attached ATA drives. ");
    console_puts("Normal HDD erasure involves (a maximum of) a single pass over the drive where all bits are set to zero.");

    console_puts("\n\nIt has been postulated by some that the \"deleted\" bits of the HDD could potentially be recovered, and so this method of deletion is not very secure. ");
    console_puts("This tool attempts to remedy the problem by providing a simple means of overwriting HDDs using multiple passes. ");
    console_puts("Simply enter the number of passes that you would like the tool to write, and it will do the rest for you.");

    console_puts("\n\nFor every odd pass, the tool will write zeroes to the disk, and for every even pass, the tool will write ones to the disk.");

    console_puts("\n\n\n\n\nPress \"ENTER\" go back.");

    wait_for_enter();
}