All pastes #139616 Raw Edit

Mine

public c v1 · immutable
#139616 ·published 2006-08-20 01:45 UTC
rendered paste body
void main(uint_32 mbinfo_magic, uint_32 mbinfo_address){	gdt_install();	idt_install();	isrs_install();	irq_install();	video_init();	printf("Popcorn %s booting...\n", POPCORN_VERSION);	printf("Build %s.\n", POPCORN_BUILD);	multiboot_check(mbinfo_magic);	// point this to the address of mbinfo	multiboot_info_t *mbinfo = (multiboot_info_t *)mbinfo_address; 	debug("Multiboot flags: %b\n", mbinfo->flags);	uint_32 ram = (mbinfo->mem_lower + mbinfo->mem_upper) / 1024;	debug("Found %d MB RAM\n", ram);	mm_init(ram);	char *cmdline = (char *)mbinfo->cmdline;	debug("Kernel is %s, given %d arguments\n", strsplit(cmdline, ' ', 0), strnumtokens(cmdline, ' ') - 1);	if (CHECK_FLAG(mbinfo->flags, 3))	{		modules_init(mbinfo->mods_count, mbinfo->mods_addr);	}	else	{		modules_init(0, 0);	}	partition_info_t pi = find_boot_partition(0x66);	if (pfs_mount(pi.drive, pi.partnum, "/", true))		panic_msg("Couldn't mount root fs");	__asm__ __volatile__ ("sti");	timer_init();	keyboard_init();	// This is broken.	uint_8 buffer[8192];	pfs_read_file("/testfile", pi.drive, pi.partnum, 0, 0, &buffer[0]);	int i;	for (i = 0; i < 20; i++)		printf("%c", buffer[i]);	kbdemo();}