void arch_prog_run(struct prog *prog) { void *cb_tables = prog_entry_arg(prog); void (*doit)(void *) = prog_entry(prog); doit(cb_tables); }
void stage_cache_add(int stage_id, const struct prog *stage) { struct imd *imd; const struct imd_entry *e; struct stage_cache *meta; void *c; imd = imd_get(); e = imd_entry_add(imd, CBMEM_ID_STAGEx_META + stage_id, sizeof(*meta)); if (e == NULL) { printk(BIOS_DEBUG, "Error: Can't add %x metadata to imd\n", CBMEM_ID_STAGEx_META + stage_id); return; } meta = imd_entry_at(imd, e); meta->load_addr = (uintptr_t)prog_start(stage); meta->entry_addr = (uintptr_t)prog_entry(stage); meta->arg = (uintptr_t)prog_entry_arg(stage); e = imd_entry_add(imd, CBMEM_ID_STAGEx_CACHE + stage_id, prog_size(stage)); if (e == NULL) { printk(BIOS_DEBUG, "Error: Can't add stage_cache %x to imd\n", CBMEM_ID_STAGEx_CACHE + stage_id); return; } c = imd_entry_at(imd, e); memcpy(c, prog_start(stage), prog_size(stage)); }
void payload_run(void) { struct prog *payload = &global_payload; /* Reset to booting from this image as late as possible */ boot_successful(); printk(BIOS_DEBUG, "Jumping to boot code at %p(%p)\n", prog_entry(payload), prog_entry_arg(payload)); post_code(POST_ENTER_ELF_BOOT); timestamp_add_now(TS_SELFBOOT_JUMP); /* Before we go off to run the payload, see if * we stayed within our bounds. */ checkstack(_estack, 0); prog_run(payload); }