mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 16:45:03 +00:00
UserspaceEmulator: Start executing in _start() instead of main()
This is one step closer to the real thing. :^)
This commit is contained in:
@@ -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());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user