示例#1
0
文件: xboot.c 项目: XVilka/2ndboot-ng
/* This function point exec stack on entry point of bootloader image in memory
 * and branch to this point 
 */
int xboot_boot(int handle) {
	bootfunc_t boot_entry;
	uint32_t bootsize, listsize;
	void *bootlist;
	uint32_t ttlb_mem, *tlb_table;

/* create aligned tlb_table */
	ttlb_mem = get_high_pages(2);
	if (ttlb_mem == 0) {
		printk("Failed to allocate new TLB table\n");
		return -ENOMEM;
	}
	if (ttlb_mem & 0x3fff) { 						
		tlb_table = (uint32_t*)(((ttlb_mem >> 14) + 1) << 14); 
		printk("unaligned TLB table\n");
		free_high_pages((void*)ttlb_mem, 2);
		return -EINVAL;
	} else {
示例#2
0
文件: hboot.c 项目: czechop/2ndboot
int hboot_boot(int handle) {
	bootfunc_t boot_entry;
	uint32_t bootsize, listsize;
	void *bootlist;
	uint32_t l1_mem, *l1_table;
    
    printk("hboot_boot\n");
	l1_mem = get_high_pages(2);
	if (l1_mem == 0) {
		printk("Failed to allocate new l1 table\n");
		return -ENOMEM;
	}
    printk("got l1_mem\n");
	if (l1_mem & 0x3fff) {
		printk("unaligned l1 table\n");
		free_high_pages((void*)l1_mem, 2);
		return -EINVAL;
	} else {
		l1_table = (uint32_t*)l1_mem;
	}
    printk("about to build l1_table\n");
	build_l1_table(l1_table);

    printk("about to get bootentry\n");
	boot_entry = get_bootentry(&bootsize, handle);
	if (boot_entry == NULL) {
		return -EINVAL;
	}
    printk("about to get bootlist\n");
	bootlist = get_bootlist(&listsize, handle);
	if (bootlist == NULL) {
		return -ENOMEM;
	}
    printk("about to do_branch... bootlist[0x%4X : 0x%4X], listsize[%d], new_ttbl[0x%4x : 0x%4X], boot_entry[0x%4X : 0x%4x]\n", (int)bootlist, (int)virt_to_phys(bootlist), (int)listsize, (int)l1_table, (int)virt_to_phys(l1_table), (int)boot_entry, (int)virt_to_phys(boot_entry));

    disable_dss();

	preempt_disable();
	local_irq_disable();
	local_fiq_disable();

    if (emu_uart)
    {
        printk("About to activate emu uart\n");
        czecho_activate_emu_uart();
        reconfigure_uart();
    }
    else
    {
        printk("skipping emu uart activation\n");
    }
    printk("About to reconfigure uart\n");

	do_branch(bootlist, listsize, virt_to_phys(l1_table), boot_entry);

/*	not a chance	*/
#if 0
	set_ttbl_base(l1_old);
	local_fiq_enable();
	local_irq_enable();
	preempt_enable();
#else
	while (1);
#endif
	return -EBUSY;
}