uint64_t elf_getEntryPoint(void *elfFile) { return ISELF32 (elfFile) ? elf32_getEntryPoint (elfFile) : elf64_getEntryPoint (elfFile); }
static void load_image(void** entry) { char* start = mod_dite_start; char* end = mod_dite_end; if(start == end) { printf("elf-loader: error, dite image is empty!\n"); abort(); } /* awiggins (2004-12-21): Should probably add an alignment check? */ /** awiggins (2005-05-29): Probably should add checks to see * the correct kind of elf file is being loaded for the platform, * or does the elf library do that somewhere?. */ if(!elf32_checkFile((struct Elf32_Header*)start)) { *entry = (void*)(uintptr_t)elf32_getEntryPoint((struct Elf32_Header*)start); } else if(!elf64_checkFile((struct Elf64_Header*)start)) { *entry = (void*)(uintptr_t)elf64_getEntryPoint((struct Elf64_Header*)start); } else { printf("elf-loader: error, dite image not a valid elf file!\n"); abort(); } #ifdef __PPC64__ if (arch_claim_memory((struct Elf32_Header*)start)) { printf("could not claim memory for elf file!\n"); abort(); } #endif if(!elf_loadFile(start, 1)) { printf("elf-loader: error, unable to load dite image!\n"); abort(); } }