mirror of
https://github.com/corda/corda.git
synced 2025-06-01 23:20:54 +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
|
classpath = classpath
|
||||||
test = test
|
test = test
|
||||||
|
|
||||||
input = $(test-build)/Enums.class
|
input = $(test-build)/Exceptions.class
|
||||||
|
|
||||||
build-cxx = g++
|
build-cxx = g++
|
||||||
build-cc = gcc
|
build-cc = gcc
|
||||||
|
@ -57,6 +57,7 @@ test:
|
|||||||
vmJump:
|
vmJump:
|
||||||
movq %rsi,%rbp
|
movq %rsi,%rbp
|
||||||
movq %rdx,%rsp
|
movq %rdx,%rsp
|
||||||
|
movq %rcx,%rbx
|
||||||
jmp *%rdi
|
jmp *%rdi
|
||||||
|
|
||||||
#elif defined __i386__
|
#elif defined __i386__
|
||||||
@ -134,6 +135,7 @@ vmJump:
|
|||||||
movl 4(%esp),%eax
|
movl 4(%esp),%eax
|
||||||
movl 8(%esp),%ebp
|
movl 8(%esp),%ebp
|
||||||
movl 12(%esp),%esp
|
movl 12(%esp),%esp
|
||||||
|
movl 16(%esp),%ebx
|
||||||
jmp *%eax
|
jmp *%eax
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
@ -14,12 +14,12 @@ extern "C" void
|
|||||||
vmCall();
|
vmCall();
|
||||||
|
|
||||||
extern "C" void NO_RETURN
|
extern "C" void NO_RETURN
|
||||||
vmJump(void* address, void* base, void* stack);
|
vmJump(void* address, void* base, void* stack, void* thread);
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
const bool Verbose = true;
|
const bool Verbose = true;
|
||||||
const bool DebugTraces = false;
|
const bool DebugTraces = true;
|
||||||
|
|
||||||
class MyThread: public Thread {
|
class MyThread: public Thread {
|
||||||
public:
|
public:
|
||||||
@ -847,20 +847,19 @@ unwind(MyThread* t)
|
|||||||
unsigned parameterFootprint = methodParameterFootprint(t, method);
|
unsigned parameterFootprint = methodParameterFootprint(t, method);
|
||||||
unsigned localFootprint = codeMaxLocals(t, methodCode(t, method));
|
unsigned localFootprint = codeMaxLocals(t, methodCode(t, method));
|
||||||
|
|
||||||
if (localFootprint > parameterFootprint) {
|
stack = static_cast<void**>(base)
|
||||||
stack -= (localFootprint - parameterFootprint);
|
- (localFootprint - parameterFootprint);
|
||||||
}
|
|
||||||
|
|
||||||
*(--stack) = t->exception;
|
*(--stack) = t->exception;
|
||||||
t->exception = 0;
|
t->exception = 0;
|
||||||
|
|
||||||
vmJump(compiled + exceptionHandlerIp(handler), base, stack);
|
vmJump(compiled + exceptionHandlerIp(handler), base, stack, t);
|
||||||
} else {
|
} else {
|
||||||
stack = static_cast<void**>(base) + 1;
|
stack = static_cast<void**>(base) + 1;
|
||||||
base = *static_cast<void**>(base);
|
base = *static_cast<void**>(base);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vmJump(returnAddress, base, stack + 1);
|
vmJump(returnAddress, base, stack + 1, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user