mirror of
https://github.com/corda/corda.git
synced 2025-01-21 03:55:00 +00:00
fix stack pointer calculation in unwind code and set rbx to thread pointer when unwinding
This commit is contained in:
parent
796a64a426
commit
86218ebcb8
2
makefile
2
makefile
@ -28,7 +28,7 @@ src = src
|
||||
classpath = classpath
|
||||
test = test
|
||||
|
||||
input = $(test-build)/Enums.class
|
||||
input = $(test-build)/Exceptions.class
|
||||
|
||||
build-cxx = g++
|
||||
build-cc = gcc
|
||||
|
@ -57,6 +57,7 @@ test:
|
||||
vmJump:
|
||||
movq %rsi,%rbp
|
||||
movq %rdx,%rsp
|
||||
movq %rcx,%rbx
|
||||
jmp *%rdi
|
||||
|
||||
#elif defined __i386__
|
||||
@ -134,6 +135,7 @@ vmJump:
|
||||
movl 4(%esp),%eax
|
||||
movl 8(%esp),%ebp
|
||||
movl 12(%esp),%esp
|
||||
movl 16(%esp),%ebx
|
||||
jmp *%eax
|
||||
|
||||
#else
|
||||
|
@ -14,12 +14,12 @@ extern "C" void
|
||||
vmCall();
|
||||
|
||||
extern "C" void NO_RETURN
|
||||
vmJump(void* address, void* base, void* stack);
|
||||
vmJump(void* address, void* base, void* stack, void* thread);
|
||||
|
||||
namespace {
|
||||
|
||||
const bool Verbose = true;
|
||||
const bool DebugTraces = false;
|
||||
const bool DebugTraces = true;
|
||||
|
||||
class MyThread: public Thread {
|
||||
public:
|
||||
@ -847,20 +847,19 @@ unwind(MyThread* t)
|
||||
unsigned parameterFootprint = methodParameterFootprint(t, method);
|
||||
unsigned localFootprint = codeMaxLocals(t, methodCode(t, method));
|
||||
|
||||
if (localFootprint > parameterFootprint) {
|
||||
stack -= (localFootprint - parameterFootprint);
|
||||
}
|
||||
stack = static_cast<void**>(base)
|
||||
- (localFootprint - parameterFootprint);
|
||||
|
||||
*(--stack) = t->exception;
|
||||
t->exception = 0;
|
||||
|
||||
vmJump(compiled + exceptionHandlerIp(handler), base, stack);
|
||||
vmJump(compiled + exceptionHandlerIp(handler), base, stack, t);
|
||||
} else {
|
||||
stack = static_cast<void**>(base) + 1;
|
||||
base = *static_cast<void**>(base);
|
||||
}
|
||||
} else {
|
||||
vmJump(returnAddress, base, stack + 1);
|
||||
vmJump(returnAddress, base, stack + 1, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user