int exec_netbsd(const char *file, int howto) { static char bibuf[BOOTINFO_MAXSIZE]; u_long marks[MARK_MAX]; int fd; BI_ALLOC(6); /* XXX */ marks[MARK_START] = 0; /* loadaddr */ if ((fd = loadfile(file, marks, LOAD_KERNEL)) == -1) goto out; printf("Start @ 0x%lx [%ld=0x%lx-0x%lx]...\n", marks[MARK_ENTRY], marks[MARK_NSYM], marks[MARK_SYM], marks[MARK_END]); { struct btinfo_common *help; char *p; int i; p = bibuf; memcpy(p, &bootinfo->nentries, sizeof(bootinfo->nentries)); p += sizeof(bootinfo->nentries); for (i = 0; i < bootinfo->nentries; i++) { help = (struct btinfo_common *)(bootinfo->entry[i]); memcpy(p, help, help->len); p += help->len; } } cache_flush(); cache_disable(); (*(void (*)(int, void *))marks[MARK_ENTRY])(howto, bibuf); panic("exec returned"); out: BI_FREE(); bootinfo = 0; return (-1); }
static int exec_netbsd(const char *file, int howto) { u_long marks[MARK_MAX]; BI_ALLOC(BTINFO_MAX); bi_howto.howto = howto; BI_ADD(&bi_howto, BTINFO_HOWTO, sizeof(bi_howto)); if (loadfile_zboot(file, marks, LOAD_KERNEL) == -1) goto out; /*NOTREACHED*/ return 0; out: BI_FREE(); bootinfo = 0; return -1; }
int exec_netbsd(const char *file, physaddr_t loadaddr, int boothowto, int floppy, void (*callback)(void)) { u_long boot_argv[BOOT_NARGS]; u_long marks[MARK_MAX]; struct btinfo_symtab btinfo_symtab; u_long extmem; u_long basemem; #ifdef DEBUG printf("exec: file=%s loadaddr=0x%lx\n", file ? file : "NULL", loadaddr); #endif BI_ALLOC(32); /* ??? */ BI_ADD(&btinfo_console, BTINFO_CONSOLE, sizeof(struct btinfo_console)); howto = boothowto; if (common_load_kernel(file, &basemem, &extmem, loadaddr, floppy, marks)) goto out; boot_argv[0] = boothowto; boot_argv[1] = 0; boot_argv[2] = vtophys(bootinfo); /* old cyl offset */ boot_argv[3] = marks[MARK_END]; boot_argv[4] = extmem; boot_argv[5] = basemem; /* pull in any modules if necessary */ if (boot_modules_enabled) { module_init(file); if (btinfo_modulelist) { BI_ADD(btinfo_modulelist, BTINFO_MODULELIST, btinfo_modulelist_size); } } userconf_init(); if (btinfo_userconfcommands != NULL) BI_ADD(btinfo_userconfcommands, BTINFO_USERCONFCOMMANDS, btinfo_userconfcommands_size); #ifdef DEBUG printf("Start @ 0x%lx [%ld=0x%lx-0x%lx]...\n", marks[MARK_ENTRY], marks[MARK_NSYM], marks[MARK_SYM], marks[MARK_END]); #endif btinfo_symtab.nsym = marks[MARK_NSYM]; btinfo_symtab.ssym = marks[MARK_SYM]; btinfo_symtab.esym = marks[MARK_END]; BI_ADD(&btinfo_symtab, BTINFO_SYMTAB, sizeof(struct btinfo_symtab)); /* set new video mode if necessary */ vbe_commit(); BI_ADD(&btinfo_framebuffer, BTINFO_FRAMEBUFFER, sizeof(struct btinfo_framebuffer)); if (callback != NULL) (*callback)(); startprog(marks[MARK_ENTRY], BOOT_NARGS, boot_argv, x86_trunc_page(basemem*1024)); panic("exec returned"); out: BI_FREE(); bootinfo = 0; return -1; }