void kmain( void* mbd, unsigned int magic ) { if ( magic != 0x2BADB002 ) { /* Something went not according to specs. Print an error */ /* message and halt, but do *not* rely on the multiboot */ /* data structure. */ } initialise_paging(); GDT::initialize(); IDT::initialize(); ISR::initialize(); AKObject<VideoDevice> AudioOut; //Device* = (*AudioOut); char something = AudioOut->moo(); //char string[] = {'H','e','l','l','o',' ','W','o','r','l','d','!','\0'}; mbd = mbd; void* a = CSAllocateMemory<uint8_t>(8); void* b = CSAllocateMemory<uint8_t>(8); void* c = CSAllocateMemory<uint8_t>(8); VGA* screen = new VGA; screen->clear(); screen->write("Hello World!"); }
int main(struct multiboot *mboot_ptr) { monitor_clear(); monitor_write("Initializing GDT...\n"); init_descriptor_tables(); monitor_write("GDT initialized.\n"); //asm volatile("int $0x3"); //asm volatile("int $0x4"); //asm volatile("sti"); //init_timer(50); initialise_paging(); monitor_write("Paging initialized.\n"); /*u32int *ptr = (u32int*)0xA0000000;*/ /*u32int do_page_fault = *ptr;*/ /*asm volatile ("int $0x3");*/ /*asm volatile ("int $0x4");*/ //monitor_write_dec(15); //monitor_write_dec(-48281); //monitor_write_dec(295180203); /*monitor_write_hex(0xFF);*/ /*monitor_put('\n');*/ /*monitor_write_hex(0x0);*/ /*monitor_put('\n');*/ /*monitor_write_hex(0xFAFABABA);*/ /*monitor_put('\n');*/ /*monitor_write_hex(0xABA);*/ // All our initialisation calls will go in here. return 0; }
int main(struct multiboot *mboot_ptr) { // All our initialisation calls will go in here. init_descriptor_tables(); monitor_clear(); initialise_paging(); // init_timer(3); int res = 0; monitor_clear(); monitor_write(str); monitor_write("\n\r"); monitor_write_hex(0xbadacacd); monitor_write_hex(0xbada0000); monitor_write("\n\r"); monitor_write_dec(0xadacacd); monitor_write("\n\r"); monitor_write_dec(1234567890); //memcpy(0xb8000+80*2*5,0xb8000,80*2*5); //memset(0xb8000,76,80*2*5); asm volatile ("int $0x3"); //u32int *ptr = (u32int*)0x0ffffff; //u32int do_page_fault = *ptr; return 0; }
int main(struct multiboot *mboot_ptr) { // Initialise all the ISRs and segmentation init_descriptor_tables(); // Initialise the screen (by clearing it) monitor_clear(); // Find the location of our initial ramdisk. ASSERT(mboot_ptr->mods_count > 0); u32int initrd_location = *((u32int*)mboot_ptr->mods_addr); u32int initrd_end = *(u32int*)(mboot_ptr->mods_addr+4); // Don't trample our module with placement accesses, please! placement_address = initrd_end; // Start paging. initialise_paging(); // Initialise the initial ramdisk, and set it as the filesystem root. fs_root = initialise_initrd(initrd_location); // list the contents of / int i = 0; struct dirent *node = 0; while ( (node = readdir_fs(fs_root, i)) != 0) { monitor_write("Found file "); monitor_write(node->name); fs_node_t *fsnode = finddir_fs(fs_root, node->name); if ((fsnode->flags&0x7) == FS_DIRECTORY) { monitor_write("\n\t(directory)\n"); } else { monitor_write("\n\t contents: \""); char buf[256]; u32int sz = read_fs(fsnode, 0, 256, buf); int j; for (j = 0; j < sz; j++) monitor_put(buf[j]); monitor_write("\"\n"); } i++; } return 0; }
int main(struct multiboot *mboot_ptr) { // All our initialisation calls will go in here. init_descriptor_tables(); initialize_monitor_vga(); vga.monitor_write("Hello World!\n"); //initialize_text_gui(); asm volatile("sti"); // initialize the timer init_timer(50); initialise_paging(); vga.monitor_write("Hello, paging world!\n"); return 0xDEADBABA; }
int main(struct multiboot *mboot_ptr, u32int initial_stack) { initial_esp = initial_stack; // Initialise all the ISRs and segmentation init_descriptor_tables(); // Initialise the screen (by clearing it) monitor_clear(); // Initialise the PIT to 100Hz asm volatile("sti"); init_timer(50); // Find the location of our initial ramdisk. ASSERT(mboot_ptr->mods_count > 0); u32int initrd_location = *((u32int*)mboot_ptr->mods_addr); u32int initrd_end = *(u32int*)(mboot_ptr->mods_addr+4); // Don't trample our module with placement accesses, please! placement_address = initrd_end; // Start paging. initialise_paging(); // Start multitasking. initialise_tasking(); // Initialise the initial ramdisk, and set it as the filesystem root. fs_root = initialise_initrd(initrd_location); // Create a new process in a new address space which is a clone of this. int ret = fork(); monitor_write("fork() returned "); monitor_write_hex(ret); monitor_write(", and getpid() returned "); monitor_write_hex(getpid()); monitor_write("\n============================================================================\n"); // The next section of code is not reentrant so make sure we aren't interrupted during. asm volatile("cli"); // list the contents of / int i = 0; struct dirent *node = 0; while ( (node = readdir_fs(fs_root, i)) != 0) { monitor_write("Found file "); monitor_write(node->name); fs_node_t *fsnode = finddir_fs(fs_root, node->name); if ((fsnode->flags&0x7) == FS_DIRECTORY) { monitor_write("\n\t(directory)\n"); } else { monitor_write("\n\t contents: \""); char buf[256]; u32int sz = read_fs(fsnode, 0, 256, buf); int j; for (j = 0; j < sz; j++) monitor_put(buf[j]); monitor_write("\"\n"); } i++; } monitor_write("\n"); asm volatile("sti"); return 0; }