From 46b42528fd41ebc7598dda8d0eaecb8a0eb126d7 Mon Sep 17 00:00:00 2001 From: gibbed Date: Wed, 16 Oct 2013 18:58:50 -0700 Subject: [PATCH] Fixed xeRtlFillMemoryUlong so it swaps the pattern back to native endianness. --- src/xenia/kernel/modules/xboxkrnl/xboxkrnl_rtl.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_rtl.cc b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_rtl.cc index 622f9a094..8769c4348 100644 --- a/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_rtl.cc +++ b/src/xenia/kernel/modules/xboxkrnl/xboxkrnl_rtl.cc @@ -138,8 +138,13 @@ void xeRtlFillMemoryUlong(uint32_t destination_ptr, uint32_t length, // TODO(benvanik): ensure byte order is correct - we're writing back the // swapped arg value. - for (uint32_t n = 0; n < length / 4; n++, p++) { - *p = pattern; + uint32_t count = length >> 2; + uint32_t native_pattern = XESWAP32BE(pattern); + + // TODO: unroll loop? + + for (uint32_t n = 0; n < count; n++, p++) { + *p = native_pattern; } }