diff --git a/src/xenia/cpu/ppc/ppc_emit_memory.cc b/src/xenia/cpu/ppc/ppc_emit_memory.cc index 7cd4f19c1..79c951bcf 100644 --- a/src/xenia/cpu/ppc/ppc_emit_memory.cc +++ b/src/xenia/cpu/ppc/ppc_emit_memory.cc @@ -9,12 +9,11 @@ #include "xenia/cpu/ppc/ppc_emit-private.h" +#include #include "xenia/base/assert.h" #include "xenia/cpu/ppc/ppc_context.h" #include "xenia/cpu/ppc/ppc_hir_builder.h" -#include - namespace xe { namespace cpu { namespace ppc { @@ -504,10 +503,26 @@ int InstrEmit_stw(PPCHIRBuilder& f, const InstrData& i) { } else { b = f.LoadGPR(i.D.RA); } - Value* offset = f.LoadConstantInt64(XEEXTS16(i.D.DS)); f.StoreOffset(b, offset, f.ByteSwap(f.Truncate(f.LoadGPR(i.D.RT), INT32_TYPE))); + + return 0; +} + +int InstrEmit_stmw(PPCHIRBuilder& f, const InstrData& i) { + Value* b; + if (i.D.RA == 0) { + b = f.LoadZeroInt64(); + } else { + b = f.LoadGPR(i.D.RA); + } + + for (uint32_t j = 0; j < 32 - i.D.RT; ++j) { + Value* offset = f.LoadConstantInt64(XEEXTS16(i.D.DS) + j * 4); + f.StoreOffset(b, offset, + f.ByteSwap(f.Truncate(f.LoadGPR(i.D.RT + j), INT32_TYPE))); + } return 0; } @@ -674,13 +689,23 @@ int InstrEmit_stdbrx(PPCHIRBuilder& f, const InstrData& i) { // Integer load and store multiple (A-16) int InstrEmit_lmw(PPCHIRBuilder& f, const InstrData& i) { - XEINSTRNOTIMPLEMENTED(); - return 1; -} + Value* b; + if (i.D.RA == 0) { + b = f.LoadZeroInt64(); + } else { + b = f.LoadGPR(i.D.RA); + } -int InstrEmit_stmw(PPCHIRBuilder& f, const InstrData& i) { - XEINSTRNOTIMPLEMENTED(); - return 1; + for (uint32_t j = 0; j < 32 - i.D.RT; ++j) { + if (i.D.RT + j == i.D.RA) { + continue; + } + Value* offset = f.LoadConstantInt64(XEEXTS16(i.D.DS) + j * 4); + Value* rt = f.ZeroExtend(f.ByteSwap(f.LoadOffset(b, offset, INT32_TYPE)), + INT64_TYPE); + f.StoreGPR(i.D.RT + j, rt); + } + return 0; } // Integer load and store string (A-17) diff --git a/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc index 0ef461683..899704404 100644 --- a/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc +++ b/src/xenia/kernel/xboxkrnl/xboxkrnl_memory.cc @@ -347,6 +347,14 @@ dword_result_t MmAllocatePhysicalMemoryEx(dword_t flags, dword_t region_size, DECLARE_XBOXKRNL_EXPORT(MmAllocatePhysicalMemoryEx, ExportTag::kImplemented | ExportTag::kMemory); +dword_result_t MmAllocatePhysicalMemory(dword_t flags, dword_t region_size, + dword_t protect_bits) { + return MmAllocatePhysicalMemoryEx(flags, region_size, protect_bits, 0, + 0xFFFFFFFFu, 0); +} +DECLARE_XBOXKRNL_EXPORT(MmAllocatePhysicalMemory, + ExportTag::kImplemented | ExportTag::kMemory); + void MmFreePhysicalMemory(dword_t type, dword_t base_address) { // base_address = result of MmAllocatePhysicalMemory.