mirror of
https://github.com/xenia-project/xenia.git
synced 2025-12-06 07:12:03 +01:00
[x64] Fix prolog/epilog sizes for emitted functions.
This commit is contained in:
parent
c808b59834
commit
c4ff8d7c58
|
|
@ -186,6 +186,7 @@ bool X64Emitter::Emit(HIRBuilder* builder, EmitFunctionInfo& func_info) {
|
||||||
sub(rsp, (uint32_t)stack_size);
|
sub(rsp, (uint32_t)stack_size);
|
||||||
|
|
||||||
code_offsets.prolog_stack_alloc = getSize();
|
code_offsets.prolog_stack_alloc = getSize();
|
||||||
|
code_offsets.body = getSize();
|
||||||
|
|
||||||
mov(qword[rsp + StackLayout::GUEST_CTX_HOME], GetContextReg());
|
mov(qword[rsp + StackLayout::GUEST_CTX_HOME], GetContextReg());
|
||||||
mov(qword[rsp + StackLayout::GUEST_RET_ADDR], rcx);
|
mov(qword[rsp + StackLayout::GUEST_RET_ADDR], rcx);
|
||||||
|
|
@ -223,8 +224,6 @@ bool X64Emitter::Emit(HIRBuilder* builder, EmitFunctionInfo& func_info) {
|
||||||
mov(GetMembaseReg(),
|
mov(GetMembaseReg(),
|
||||||
qword[GetContextReg() + offsetof(ppc::PPCContext, virtual_membase)]);
|
qword[GetContextReg() + offsetof(ppc::PPCContext, virtual_membase)]);
|
||||||
|
|
||||||
code_offsets.body = getSize();
|
|
||||||
|
|
||||||
// Body.
|
// Body.
|
||||||
auto block = builder->first_block();
|
auto block = builder->first_block();
|
||||||
while (block) {
|
while (block) {
|
||||||
|
|
@ -253,13 +252,14 @@ bool X64Emitter::Emit(HIRBuilder* builder, EmitFunctionInfo& func_info) {
|
||||||
block = block->next;
|
block = block->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
code_offsets.epilog = getSize();
|
|
||||||
|
|
||||||
// Function epilog.
|
// Function epilog.
|
||||||
L(epilog_label);
|
L(epilog_label);
|
||||||
epilog_label_ = nullptr;
|
epilog_label_ = nullptr;
|
||||||
EmitTraceUserCallReturn();
|
EmitTraceUserCallReturn();
|
||||||
mov(GetContextReg(), qword[rsp + StackLayout::GUEST_CTX_HOME]);
|
mov(GetContextReg(), qword[rsp + StackLayout::GUEST_CTX_HOME]);
|
||||||
|
|
||||||
|
code_offsets.epilog = getSize();
|
||||||
|
|
||||||
add(rsp, (uint32_t)stack_size);
|
add(rsp, (uint32_t)stack_size);
|
||||||
ret();
|
ret();
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue