예제 #1
1
파일: memtest.c 프로젝트: Happykat/ATOS
unsigned int memtest(multiboot_info_t* mbd, unsigned int magic)
{

	magic = (int) magic;

	terminal_writestring(MULTIBOOT_TEST);

	if (CHECK_BIT(mbd->flags, 0))
	{
		vgatestok();
		terminal_writestring(MEMORY_MAP_TEST);
		
		if (CHECK_BIT(mbd->flags, 6))
		{
			vgatestok();
			terminal_printf("\nLower memory : %d KB\n", mbd->mem_lower);
			terminal_printf("Upper memory : %d KB\n\n", mbd->mem_upper);
		}

		else
		{
			vgatestko();
			return (1);
		}

		return (0);
	}

	vgatestko();
	return (1);
}
예제 #2
0
파일: terminal.c 프로젝트: jhd/jhDOS
void terminalWriteHexLong(unsigned int upper, unsigned int lower){
    char string[12];
    terminal_writestring("0x");
    terminal_writestring(intToString(upper, string, 16));
    terminal_writestring(" ");
    terminal_writestring(intToStringPadded(lower, string, 16));
}
void kernel_main() {
    /* Initialize terminal interface */
    terminal_initialize();
 
    /* Since there is no support for newlines in terminal_putchar
         * yet, '\n' will produce some VGA specific character instead.
         * This is normal.
         */

    char buffer[8];

    for (int i = 1; i <= 100; i++) {
        if (i % 3 == 0 && i % 5 == 0) {
            terminal_writestring("FizzBuzz");
        } else if (i % 3 == 0) {
            terminal_writestring("Fizz");
        } else if (i % 5 == 0) {
            terminal_writestring("Buzz");
        } else {
            terminal_writestring(itoa(i, buffer, 10));
        }

        if (i < 100) {
            terminal_writestring(", ");
        }
    }
}
예제 #4
0
// This gets called from our ASM interrupt handler stub.
void
isr_handler(err_t *err) {
    terminal_writestring("received interrupt: ");
    terminal_writenum(err->int_no);
    terminal_writestring(", ");
    terminal_writenum(err->err_code);
    terminal_writestring("\n");
}
예제 #5
0
파일: terminal.c 프로젝트: mehtarupesh/myos
void terminal_test() {

    size_t i;
    terminal_writestring(test_string);
    for(i = 0; i < VGA_HEIGHT; i++) {
        terminal_writestring("Hello Mehta\n");
    }
    terminal_writestring(test_string);
}
예제 #6
0
파일: kernel.cpp 프로젝트: Cutebyte/ROSE
void kernel_main() {
    //init terminal
    terminal_initialize();

    terminal_writestring("1Hello world! IT'S ALIVE!!!\n2Newline testing...\n3It works.");
    terminal_writestring("\n4\n5\n6wew\n7ewe\n8wew\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n21\n22\n23\n24 lines. Next one should mess things up.");
    terminal_writestring("\n25First ruiner");
    terminal_writestring("\n26Second ruiner");
}
예제 #7
0
void kernel_main() {

  terminal_initialize();

  terminal_writestring("--< Kernel >--\n");

  for (int i = 0; i < 50; i++) {
    terminal_writestring("Hello, World!\n");
  }
}
예제 #8
0
파일: kernel.c 프로젝트: hoke-t/Discite
void kernel_main() {
    /* Initialize terminal interface */
    terminal_initialize();
 
    /* Since there is no support for newlines in terminal_putchar
         * yet, '\n' will produce some VGA specific character instead.
         * This is normal.
         */
    terminal_writestring("Hello, my name is Tanner. I am 16 years old, and this is my operating system!\n");
    terminal_writestring("This should be on a new line.\n");
}
예제 #9
0
파일: kernel.c 프로젝트: FaideWW/faideos
void kernel_main() {
    /* Initialize terminal interface */
    terminal_initialize();

    terminal_writestring("You shouldn't see this string if scrolling works...\n");
    for (size_t row = 0; row < VGA_HEIGHT - 1; row++) {
        terminal_writerainbow("Hello kernel world!\n");
    }
    terminal_setcolor(COLOR_LIGHT_GREY);
    terminal_writestring("Reached bottom of terminal");

}
예제 #10
0
// memblock_inspect - print linked list overview
// This function traverses the list and prints debugging info (struct data members) to console.
void memblock_inspect() {
#ifdef DEBUG
    k_heap_blk* blk = heap.start;
    while((blk != NULL)) { // Don't compress the first or last block in the heap.
        kprintf("Heap block located at 0x%x:\nblk->prev: 0x%x\nblk->next: 0x%x", (size_t)blk, (size_t)blk->prev, (size_t)blk->next);
        if(blk->used)
            terminal_writestring("\nBlock marked as \'used\'.\n");
        else
            terminal_writestring("\nBlock marked as \'free\'.\n");
        blk = blk->next;
    }
#endif
}
예제 #11
0
파일: kernel.c 프로젝트: SuNaden/OS-sunaden
void kernel_main() {
	/* Initialize terminal interface */
	terminal_initialize();

	/* Since there is no support for newlines in terminal_putchar
         * yet, '\n' will produce some VGA specific character instead.
         * This is normal.
         */

	terminal_writestring("Hello, hielep!\n");
	terminal_writestring("Hello, hfdsfdsp!\n");

}
예제 #12
0
파일: gdt.c 프로젝트: Hammerstad/HammerOS
void init_gdt()
{
    terminal_writestring("Initiating GDT...          ");
    gdt_ptr.limit = (sizeof(gdt_entry_t) * 3) - 1;
    gdt_ptr.base  = (uint32_t)&gdt_entries;
    
    gdt_set_gate(0, 0, 0, 0, 0);                // Null segment
    gdt_set_gate(1, 0, 0xFFFFFFFF, 0x9A, 0xCF); // Kernel code segment
    gdt_set_gate(2, 0, 0xFFFFFFFF, 0x92, 0xCF); // Kernel data segment
    
    gdt_flush((uint32_t)&gdt_ptr);
    terminal_writestring("DONE\n");
}
예제 #13
0
파일: scheduler.c 프로젝트: MyEyes/Nos
void schedule_exit()
{
	curr_task->state = TSK_Exited;
	curr_task->time_slice = 0;
	task_context_t* stack = (task_context_t*)(curr_task->esp);
	int retval = stack->eax;
	terminal_writestring("Task exited ");
	terminal_writeuint32(retval);
	terminal_writestring("\n");
	schedule();
	curr_task = next_task;
	resume_task();
}
예제 #14
0
파일: scheduler.c 프로젝트: MyEyes/Nos
void schedule_kill()
{
	curr_task->state = TSK_Terminated;
	terminal_writestring("Killed task: \n");
	task_print(curr_task);
	schd_task_del(curr_task);
	
	schedule();
	
	curr_task = next_task;
	terminal_writestring("Resuming\n");
	bochs_break();
	resume_task();
}
예제 #15
0
void kernel_early(multiboot_t *mboot, uint32_t magic, uintptr_t esp)
{
	initialize_terminal();
	terminal_writestring("[TTY]   ...  \x1b[32mDONE\n\x1b[00m[GDT]   ... ");
	initialize_gdt();
	terminal_writestring("\x1b[32mDONE\n\x1b[00m[IDT]   ... ");
	initialize_idt();
	terminal_writestring("\x1b[32mDONE\n\x1b[00m[IRQ]   ... ");
	initialize_irq();
	__asm__ __volatile__("sti");
	terminal_writestring("\x1b[32mDONE\n\x1b[00m[PAGE]  ... ");
	initialize_paging(mboot->mem_upper + mboot->mem_lower);
	terminal_writestring("\x1b[32mDONE\n\x1b[00m");

}
예제 #16
0
파일: kernel.c 프로젝트: mapfap/MapOS
void kernel_main()
{
	terminal_initialize();
	/* Since there is no support for newlines in terminal_putchar yet, \n will
	   produce some VGA specific character instead. This is normal. */
	terminal_writestring("Hello, kernel World!\n");
}
예제 #17
0
파일: kernel.cpp 프로젝트: lovelaze/os
void kmain()
{
	terminal_initialize();
	terminal_writestring("H\ne\nl\nl\no\nk\nH\ne\nl\nl\no\nk\nH\ne\nl\nl\no\nk\nH\ne\nl\nl\no\nk\nH\ne\nA\np");
	

}
예제 #18
0
파일: main.c 프로젝트: Xsixteen/FuseOS
void kernel_main(unsigned int ebx)
{
        mbinfo = (multiboot_info_t *) ebx;
        // module_address 		 = mbinfo->mods_addr;

	/* Initialize terminal interface */
	terminal_initialize();
	idt_init();

	/* Newline support is left as an exercise. */
	terminal_writestring("FuseOS v.0.0.1\n");
	terminal_writestring("Enabling Interrupts\n");
	if(mbinfo->mods_count == 1) {
		terminal_writestring("Module Count = 1, Sample Program can be loaded\n");	
	}
	for(;;);
}
예제 #19
0
파일: init.c 프로젝트: zhidou/OS_Projects
void schedule()
{

  if (!heapLenght)
  {
    terminal_writestring("No more tasks!");
    __asm__ volatile("jmp loop\n\t");
  }
예제 #20
0
파일: kernel.c 프로젝트: GalacticOne/StarOS
void kernel_main() {
  /* Initialize terminal interface */
  terminal_initialize();

  /* since there is no support for newlines in terminal_putchar
   * yet, '\n' will prouce some VGA specific character instead.
   * This is normal.
   */
   terminal_writestring("A single step.\n");
}
예제 #21
0
파일: loader.c 프로젝트: mogaika/torchos
void print_requirement(const char *text, bool have) {
	terminal_setcolor(make_color(FGCOLOR, BGCOLOR));
	terminal_printf(" - %s ", text);

	size_t textlen = strlen(text);
	for (size_t pneed = textlen; pneed < 32; pneed++) {
		terminal_putchar('.');
	}

	terminal_putchar('[');
	if (have) {
		terminal_setcolor(make_color(COLOR_GREEN, BGCOLOR));
		terminal_writestring("OK");
	} else {
		terminal_setcolor(make_color(COLOR_RED, BGCOLOR));
		terminal_writestring("FAIL");
	}
	terminal_setcolor(make_color(FGCOLOR, BGCOLOR));
	terminal_writestring("]\n");
}
예제 #22
0
파일: graphics.c 프로젝트: superaxander/OS
void drawImage(enum vga_color img[25][80])
{
    size_t x, y;
    for (x = 0; x < 80; ++x)
    {
        for (y = 0; y < 25; ++y)
        {
            terminal_set_pos(x,y);
            terminal_setcolor(0, img[y][x]);
            terminal_writestring(" ");
        }
    }
}
예제 #23
0
void kernel_main() {
  gdt_install();
  idt_install();
  isrs_install();
  irq_install();
  terminal_initialize();
  memory_manager_init();
  enable_interrupts();
  timer_install();
  keyboard_install();
  shell_init();

  terminal_writestring("Hello, kernel World!\n");
  terminal_writestring("Here is some text in a new line\n");
  terminal_writestring("Here is some more text\n");
  terminal_writestring("Here is a new line\n");
  terminal_writestring("Here is some text after terminal scroll\n");
  char str[] = "A string";
  char ch = 'c';
  int integer = 45;
  printf("This is a test for printf.\nThis is a char %c and this a string %s\n", ch, str);
  printf("This is an int %d. This is the same in hex %x\n", integer, integer);

  for (size_t i = 0; i < 5; i++) {
    printf("This is line number %d\n", i);
  }

  puts("waiting for 2 sec\n");
  timer_wait(2);
  puts("waiting complete\n");

  char buffer[200];
  gets(buffer);
  printf("%s\n", buffer);
  while(1) {
    shell();
  }

}
예제 #24
0
파일: main.cpp 프로젝트: stmobo/Omamori
static int lua_writeout_proxy(lua_State *st) {
    int n_args = lua_gettop(st);
    unsigned int ret = 0;
    for(int i=1;i<=n_args;i++) {
        if( lua_isstring(st, i) ) {
            const char *out = lua_tostring(st, i);
            terminal_writestring(const_cast<char*>(out));
            ret += strlen(const_cast<char*>(out));
        }
    }
    terminal_putchar('\n');
    lua_pushnumber(st, ret);
    return 1;
}
예제 #25
0
파일: isr.c 프로젝트: thatoddmailbox/hexos
// This function handles all interrupts.
void fault_handler(struct regs *r)
{
    dbgprint("interrupt!\n");
    if (interrupt_handlers[r->int_no] != 0) {
        (interrupt_handlers[r->int_no]) (r->int_no, r->int_no); // not sure what the second param is for...
        return;
    }
    // unhandled!
    // Is this a fault whose number is from 0 to 31?
    if (r->int_no < 32)
    {
        if (!current) {
            if (r->int_no == 2) {
                // it's an NMI. oh noes
                // we shouldn't do much other than text, to avoid triggering the faulty hardware again

                terminal_initialize(); // clear terminal
                terminal_setcolor(COLOR_RED); // set it to a spooky color

                // show scary message for scary error
                terminal_writestring("*** NON-MASKABLE INTERRUPT OCCURRED ***\n\n");

                terminal_writestring("To protect your computer and data, HexOS has stopped.\n\n");

                terminal_writestring("A critical non-recoverable and non-maskable hardware interrupt has occurred. This may mean that your computer's hardware is defective. If this error occurs multiple times, try isolating the problem by removing and/or replacing components.");
                while (1) {}
            }
            printf("Error code: %d\n", r->err_code);
            // Display the description for the Exception that occurred.
            panic(exception_messages[r->int_no]);
            for (;;);
        } else {
            // TODO: signal the process rather than kill it
            process_exit(-1, exception_messages[r->int_no]); // kill the process
        }
    }
}
예제 #26
0
void kernel_init(multiboot_info_t* mb_info, unsigned int magic) {
    terminal_initialize();
    terminal_writestring("Project Omamori now starting...\n");
    gdt_init();
    idt_init();
    initialize_vmem_allocator();
    k_heap_init();
    initialize_pageframes(mb_info);
    
    // do global constructor setup
    kprintf("Calling global constructors.\n");
    size_t *current = (size_t*)((size_t)&__CTOR_LIST__+4); // skip the first function pointer
    int n_constructors_called = 1;
    while(true) {
        if(*current == 0)
            break;
        //kprintf("Calling constructor %u at address 0x%x.\n", (unsigned long long int)n_constructors_called, ((unsigned long long int)*current) );
        void(*func)(void) = (void(*)(void))(*current);
        func();
        current++;
        n_constructors_called++;
    }
    kprintf("Called %u global constructors.\n", (unsigned long long int)n_constructors_called);
    
    //system_halt;
    kprintf("Kernel begins at physical address 0x%x, corresponding to pageframe ID %u.\n", (unsigned long long int)(&kernel_start_phys), (unsigned long long int)(pageframe_get_block_from_addr( (size_t)&kernel_start_phys )) );
    kprintf("Kernel ends at physical address 0x%x, corresponding to pageframe ID %u.\n", (unsigned long long int)(&kernel_end_phys), (unsigned long long int)(pageframe_get_block_from_addr( (size_t)&kernel_end_phys )) );
    
    terminal_writestring("\nInitializing PICs.\n");
    pic_initialize(PIC_IRQ_OFFSET_1, PIC_IRQ_OFFSET_2);
    set_all_irq_status(true);
    
    terminal_writestring("Initializing PIT.\n");
    pit_initialize(PIT_DEFAULT_FREQ_DIVISOR);
    //system_halt
}
예제 #27
0
파일: graphics.c 프로젝트: superaxander/OS
void drawBox(size_t minX, size_t minY, size_t  maxX, size_t maxY, enum vga_color fg, enum vga_color bg)
{
    size_t x, y;
    terminal_setcolor(fg, bg);

    for (x = minX; x < maxX; ++x)
    {
        for (y = minY; y < maxY; ++y)
        {
            terminal_set_pos(x, y);
            terminal_writestring(" ");
        }
    }

}
예제 #28
0
파일: scheduler.c 프로젝트: MyEyes/Nos
void init_scheduler()
{
	terminal_writestring("Initializing scheduler\n");
	memzero(tasks, sizeof(task_t*)*SCHEDULER_MAX_TASKS);
	
	//Initialize jump array
	tasks[0] = (void*)SCHEDULER_MAX_TASKS;
	curr_task = 0;
	next_task = 0;
	
	set_idt_desc(IRQ_OFFSET+0x00, (uint32_t)&schedule_handler, 0, IntGate32, 0x08);
	set_idt_desc(PROC_EXIT, (uint32_t)&exit_handler, 3, IntGate32, 0x08);
	set_idt_desc(PROC_YIELD, (uint32_t)&yield_handler, 3, IntGate32, 0x08);
	
}
예제 #29
0
파일: meminfo.c 프로젝트: MyEyes/Nos
void print_mem_type(uint32_t val)
{
	switch(val)
	{
		case 1: terminal_writestring("Usable   "); break;
		case 2: terminal_writestring("Reserved "); break;
		case 3: terminal_writestring("ACPI Rec "); break;
		case 4: terminal_writestring("ACPI NVS "); break;
		case 5: terminal_writestring("Bad Mem  "); break;
		default: terminal_writestring("         "); break;
	}
}
예제 #30
0
파일: kernel.c 프로젝트: luk2010/APrOS
void kernel_main()
{
	terminal_cls(COLOR_LIGHT_BLUE);
	terminal_setcolor(make_color(COLOR_WHITE, COLOR_LIGHT_BLUE));
	/* Since there is no support for newlines in terminal_putchar yet, \n will
	   produce some VGA specific character instead. This is normal. */
	terminal_writestring("Hello, kernel World!\n");

	terminal_printf("This is the base string terminal system !\n");

	if(apros_setup_gdt() > 0)
		terminal_printf("GDT correctly setted !\n");
	if(apros_setup_idt())
		terminal_printf("IDT correctly setted ! \n");

	for(;;)
		continue;
}