//--- // fxBoot:hypervisor:loader:entry - ELF Loader entry //--- #include "fxBoot/hypervisor.h" #include "fxBoot/terminal.h" #include "fxBoot/fs/smemfs.h" #include "fxBoot/elf.h" /* internal header */ #include "../src/hypervisor/internal/elf.h" /* loader_entry(): Load a ELF programm (PIE) */ int hypervisor_elf_loader(struct hworld *world, struct smemfs_inode *inode) { Elf32_Ehdr header; int err; if (world == NULL) return (-1); /* save private information */ terminal_write("- load ELF file \"%s\"\n", inode->name); world->private.inode = inode; /* Try to get the ELF header information */ terminal_write("- check header information\n"); err = hypervisor_elf_loader_header_get(inode, &header); if (err != 0) return (-2); /* Get / Check program validity */ terminal_write("- load image\n"); err = hypervisor_elf_loader_image_load(world, inode, &header); if (err != 0) return (-3); /* Relocalise sections / symbols */ terminal_write("- relocalize symbols\n"); err = hypervisor_elf_loader_reloc_sym(world, inode, &header); if (err != 0) return (-4); return (0); }