diff options
author | Gunnar Beutner <gbeutner@serenityos.org> | 2021-07-11 16:57:38 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-07-12 12:27:13 +0200 |
commit | cbdc7f9e416857d2c20f0c147bfa1481ccb22ddc (patch) | |
tree | 35c01fdf27e2b20da9c9b8bd372852a2d3881fee /Userland/DevTools/UserspaceEmulator | |
parent | 1455604b1382d1ada8d89c8aa7961dd5fb7dc4b6 (diff) | |
download | serenity-cbdc7f9e416857d2c20f0c147bfa1481ccb22ddc.zip |
UserspaceEmulator: Fix stack for new processes
Fixes #8646.
Diffstat (limited to 'Userland/DevTools/UserspaceEmulator')
-rw-r--r-- | Userland/DevTools/UserspaceEmulator/Emulator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Userland/DevTools/UserspaceEmulator/Emulator.cpp b/Userland/DevTools/UserspaceEmulator/Emulator.cpp index 4529bcb1a6..9dcfee8091 100644 --- a/Userland/DevTools/UserspaceEmulator/Emulator.cpp +++ b/Userland/DevTools/UserspaceEmulator/Emulator.cpp @@ -134,13 +134,15 @@ void Emulator::setup_stack(Vector<ELF::AuxiliaryValue> aux_vector) m_cpu.push32(shadow_wrap_as_initialized(argv_entries[i])); u32 argv = m_cpu.esp().value(); - m_cpu.push32(shadow_wrap_as_initialized<u32>(0)); // (alignment) + while ((m_cpu.esp().value() + 4) % 16 != 0) + m_cpu.push32(shadow_wrap_as_initialized<u32>(0)); // (alignment) u32 argc = argv_entries.size(); m_cpu.push32(shadow_wrap_as_initialized(envp)); m_cpu.push32(shadow_wrap_as_initialized(argv)); m_cpu.push32(shadow_wrap_as_initialized(argc)); - m_cpu.push32(shadow_wrap_as_initialized<u32>(0)); // (alignment) + + VERIFY(m_cpu.esp().value() % 16 == 0); } bool Emulator::load_elf() |