1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-02 22:12:08 +00:00

UserspaceEmulator: Start executing in _start() instead of main()

This is one step closer to the real thing. :^)
This commit is contained in:
Andreas Kling 2020-07-09 15:47:10 +02:00
parent 066ae29c07
commit 3a73fdd244

View file

@ -48,15 +48,15 @@ int main(int argc, char** argv)
auto elf = ELF::Loader::create((const u8*)mapped_file.data(), mapped_file.size());
auto main_symbol = elf->find_demangled_function("main");
if (!main_symbol.has_value()) {
warn() << "Could not find 'main' symbol in executable";
auto _start_symbol = elf->find_demangled_function("_start");
if (!_start_symbol.has_value()) {
warn() << "Could not find '_start' symbol in executable";
return 1;
}
auto main_code = main_symbol.value().raw_data();
auto main_code = _start_symbol.value().raw_data();
X86::SimpleInstructionStream stream((const u8*)main_code.characters_without_null_termination(), main_code.length());
UserspaceEmulator::Emulator emulator;
return emulator.exec(stream, main_symbol.value().value());
return emulator.exec(stream, _start_symbol.value().value());
}