mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 00:07:34 +00:00
UserspaceEmulator: Start executing in _start() instead of main()
This is one step closer to the real thing. :^)
This commit is contained in:
parent
066ae29c07
commit
3a73fdd244
1 changed files with 5 additions and 5 deletions
|
@ -48,15 +48,15 @@ int main(int argc, char** argv)
|
||||||
|
|
||||||
auto elf = ELF::Loader::create((const u8*)mapped_file.data(), mapped_file.size());
|
auto elf = ELF::Loader::create((const u8*)mapped_file.data(), mapped_file.size());
|
||||||
|
|
||||||
auto main_symbol = elf->find_demangled_function("main");
|
auto _start_symbol = elf->find_demangled_function("_start");
|
||||||
if (!main_symbol.has_value()) {
|
if (!_start_symbol.has_value()) {
|
||||||
warn() << "Could not find 'main' symbol in executable";
|
warn() << "Could not find '_start' symbol in executable";
|
||||||
return 1;
|
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());
|
X86::SimpleInstructionStream stream((const u8*)main_code.characters_without_null_termination(), main_code.length());
|
||||||
|
|
||||||
UserspaceEmulator::Emulator emulator;
|
UserspaceEmulator::Emulator emulator;
|
||||||
return emulator.exec(stream, main_symbol.value().value());
|
return emulator.exec(stream, _start_symbol.value().value());
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue