#include #include #include #include #include #include #include "elf-loader.h" #include "sync.h" #include "gecko.h" extern void __exception_closeall(void); //taken from https://github.com/Fullmetal5/WiiNetworkLoader //Note: There isn't any point for printf() messages, since you can't read them fast enough anyway void boot_elf(void *payload, size_t size) { gprintf("Shutting down IOS Subsystems... "); __IOS_ShutdownSubsystems(); gprintf("OK"); gprintf("Shutting down CPU ISR... "); uint32_t level; _CPU_ISR_Disable(level); gprintf("OK"); gprintf("Shutting down exception vectors... "); __exception_closeall(); gprintf("OK"); gprintf("Copying ELF loading stub... "); memcpy((void*)0x81330000, loader_bin, loader_bin_len); sync_before_exec((void*)0x81330000, loader_bin_len); gprintf("OK"); gprintf("Jumping to entry point!"); void (*entry)(void*, uint32_t) = (void*)0x81330000; entry(payload, size); printf("If you can see this then something has gone very wrong!\n"); gprintf("ELF failed to load somehow!"); fflush(stdout); while(1); }