Bug 916106 - Avoid unwind loop when erroneously in leaf. r=BenWa

This commit is contained in:
Jed Davis 2013-10-16 14:42:49 -04:00
Родитель e2374a4634
Коммит dfdb1704c2
1 изменённых файлов: 12 добавлений и 1 удалений

Просмотреть файл

@ -342,8 +342,19 @@ bool EHInterp::unwind() {
// 1011000: Finish
if (insn == I_FINISH) {
if (mState[R_PC] == 0)
if (mState[R_PC] == 0) {
mState[R_PC] = mState[R_LR];
// Non-standard change (bug 916106): Prevent the caller from
// re-using LR. Since the caller is by definition not a leaf
// routine, it will have to restore LR from somewhere to
// return to its own caller, so we can safely zero it here.
// This makes a difference only if an error in unwinding
// (e.g., caused by starting from within a prologue/epilogue)
// causes us to load a pointer to a leaf routine as LR; if we
// don't do something, we'll go into an infinite loop of
// "returning" to that same function.
mState[R_LR] = 0;
}
return true;
}