a32_address_space: Add StackLayout to stack

This commit is contained in:
Merry 2022-07-22 14:53:49 +01:00 committed by merry
parent 9b2391ec7b
commit 80c89401b9

View file

@ -7,6 +7,7 @@
#include "dynarmic/backend/arm64/abi.h" #include "dynarmic/backend/arm64/abi.h"
#include "dynarmic/backend/arm64/emit_arm64.h" #include "dynarmic/backend/arm64/emit_arm64.h"
#include "dynarmic/backend/arm64/stack_layout.h"
#include "dynarmic/frontend/A32/a32_location_descriptor.h" #include "dynarmic/frontend/A32/a32_location_descriptor.h"
#include "dynarmic/frontend/A32/translate/a32_translate.h" #include "dynarmic/frontend/A32/translate/a32_translate.h"
#include "dynarmic/ir/opt/passes.h" #include "dynarmic/ir/opt/passes.h"
@ -79,11 +80,13 @@ void A32AddressSpace::EmitPrelude() {
for (int i = 0; i < 32; i += 2) { for (int i = 0; i < 32; i += 2) {
code.STP(QReg{i}, QReg{i + 1}, SP, PRE_INDEXED, -32); code.STP(QReg{i}, QReg{i + 1}, SP, PRE_INDEXED, -32);
} }
code.SUB(SP, SP, sizeof(StackLayout));
code.MOV(Xstate, X1); code.MOV(Xstate, X1);
code.MOV(Xhalt, X2); code.MOV(Xhalt, X2);
code.BR(X0); code.BR(X0);
prelude_info.return_from_run_code = code.ptr<void*>(); prelude_info.return_from_run_code = code.ptr<void*>();
code.ADD(SP, SP, sizeof(StackLayout));
for (int i = 30; i >= 0; i -= 2) { for (int i = 30; i >= 0; i -= 2) {
code.LDP(QReg{i}, QReg{i + 1}, SP, POST_INDEXED, 32); code.LDP(QReg{i}, QReg{i + 1}, SP, POST_INDEXED, 32);
} }