Exemplo n.º 1
0
void multiboot_loader(uint32_t uMagic, multiboot_info_t *pMultiboot) {
	uint32_t uPhysicalMemoryTotal, uMultibootMmapLenght;
	multiboot_memory_map_t *pMultibootMmap;

	if (!init_screen())
		return;

	if (!process_cpu_features())
		return;

	if (!process_multiboot(uMagic, pMultiboot, &uPhysicalMemoryTotal, &pMultibootMmap, &uMultibootMmapLenght))
		return;

	phys_alloc_init(pMultibootMmap, uMultibootMmapLenght);
	
	if (!virt_init())
		return;
	
	uint64_t entry = load_kernel(__PACKED_KERNEL_START, __PACKED_KERNEL_END);
	
	_goto64(entry);
}
Exemplo n.º 2
0
void kmain( struct multiboot_info * info )
{
	page_init();	/* we start up with a hacked segment base, so */
	gdt_init();		/* get paging enabled and a real GDT installed first. */
	
	vga_clear();
	
	put_status_line( 1, "Paging enabled." );
	put_status_line( 1, "Starting Physical Memory Allocator..." );
	phys_alloc_init( info );
	
	put_status_line( 1, "Starting Kernel Heap Allocator..." );
	kmalloc_init();	
	page_init_finish();
	
	/* install other default handlers */
	
	timer_init( 50 );
	
	/* test the heap allocator */
	int * foo = kmalloc( 240 );
	vga_puts( "Allocation test: " );
	vga_put_hex( (u32) foo );
	vga_puts( "\n" );
	
	*foo = 42;	/* shouldn't die */
	
	put_status_line( 1, "Scanning PCI buses..." );
	pci_enum_devices();
	
	/* finished initializing, so turn on the interrupts */
	enable_interrupts();
	
//	asm volatile( "int $0x3" );
	
	for(;;)
		halt();
}