diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-12-03 10:37:16 +0100 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@theqtcompany.com> | 2014-12-03 10:50:07 +0100 |
commit | 2509e9b7bcb9f06351016433244e529436f380cc (patch) | |
tree | 5b2dc9738a38d697a0c91579252c937379b443a3 | |
parent | d40fcf19f7768e6ae80532ff3d8a416132594f87 (diff) |
Fix crashes on QNX/x86
On x86 we assume that ebx holds the address of the global offset table for
position independent code. So before placing a run-time call we restore the
register from it's position we saved it on earlier on the stack. However after
commit d9f33ccdef985badc56fd8940373748626beffc7 the register wasn't saved on the
stack anymore in the prologue because we skipped because it's caller saved. So
when we seemingly reloaded ebx with the GOT from the stack, we loaded it from a location
we never saved it to. This patch makes sure to always save it on the stack so that
we can always restore it.
Change-Id: I8f6a8e38779151fff517f17220f29a7cb45ca89d
Task-number: QTBUG-43036
Reviewed-by: Erik Verbruggen <erik.verbruggen@theqtcompany.com>
-rw-r--r-- | src/qml/jit/qv4isel_masm.cpp | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/qml/jit/qv4isel_masm.cpp b/src/qml/jit/qv4isel_masm.cpp index 9ff33feff2..f4a1ec5f69 100644 --- a/src/qml/jit/qv4isel_masm.cpp +++ b/src/qml/jit/qv4isel_masm.cpp @@ -1530,16 +1530,15 @@ void InstructionSelection::calculateRegistersToSave(const RegisterInformation &u fpRegistersToSave.clear(); foreach (const RegisterInfo &ri, Assembler::getRegisterInfo()) { +#if defined(RESTORE_EBX_ON_CALL) + if (ri.isRegularRegister() && ri.reg<JSC::X86Registers::RegisterID>() == JSC::X86Registers::ebx) { + regularRegistersToSave.append(ri); + continue; + } +#endif // RESTORE_EBX_ON_CALL if (ri.isCallerSaved()) continue; - if (ri.isRegularRegister()) { -#if defined(RESTORE_EBX_ON_CALL) - if (ri.isRegularRegister() && ri.reg<JSC::X86Registers::RegisterID>() == JSC::X86Registers::ebx) { - regularRegistersToSave.append(ri); - continue; - } -#endif // RESTORE_EBX_ON_CALL if (ri.isPredefined() || used.contains(ri)) regularRegistersToSave.append(ri); } else { |