diff options
author | Tony Wasserka <NeoBrainX@gmail.com> | 2014-07-25 11:22:40 +0200 |
---|---|---|
committer | Tony Wasserka <NeoBrainX@gmail.com> | 2014-08-25 22:02:33 +0200 |
commit | e832bbe554e174694cb43d4fe86f31af283a10da (patch) | |
tree | 3f531825b588c74ae12775e997869b35b33fc072 | |
parent | Merge pull request #75 from xsacha/qt5 (diff) | |
download | yuzu-e832bbe554e174694cb43d4fe86f31af283a10da.tar yuzu-e832bbe554e174694cb43d4fe86f31af283a10da.tar.gz yuzu-e832bbe554e174694cb43d4fe86f31af283a10da.tar.bz2 yuzu-e832bbe554e174694cb43d4fe86f31af283a10da.tar.lz yuzu-e832bbe554e174694cb43d4fe86f31af283a10da.tar.xz yuzu-e832bbe554e174694cb43d4fe86f31af283a10da.tar.zst yuzu-e832bbe554e174694cb43d4fe86f31af283a10da.zip |
-rw-r--r-- | src/core/hle/service/gsp.cpp | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp index 635f50a53..f793b592c 100644 --- a/src/core/hle/service/gsp.cpp +++ b/src/core/hle/service/gsp.cpp @@ -42,35 +42,40 @@ static inline InterruptRelayQueue* GetInterruptRelayQueue(u32 thread_id) { sizeof(InterruptRelayQueue) * thread_id); } -/// Write a GSP GPU hardware register -void WriteHWRegs(Service::Interface* self) { - u32* cmd_buff = Service::GetCommandBuffer(); - u32 reg_addr = cmd_buff[1]; - u32 size = cmd_buff[2]; - +void WriteHWRegs(u32 base_address, u32 size_in_bytes, const u32* data) { // TODO: Return proper error codes - if (reg_addr + size >= 0x420000) { - ERROR_LOG(GPU, "Write address out of range! (address=0x%08x, size=0x%08x)", reg_addr, size); + if (base_address + size_in_bytes >= 0x420000) { + ERROR_LOG(GPU, "Write address out of range! (address=0x%08x, size=0x%08x)", + base_address, size_in_bytes); return; } // size should be word-aligned - if ((size % 4) != 0) { - ERROR_LOG(GPU, "Invalid size 0x%08x", size); + if ((size_in_bytes % 4) != 0) { + ERROR_LOG(GPU, "Invalid size 0x%08x", size_in_bytes); return; } - u32* src = (u32*)Memory::GetPointer(cmd_buff[0x4]); - - while (size > 0) { - GPU::Write<u32>(reg_addr + 0x1EB00000, *src); + while (size_in_bytes > 0) { + GPU::Write<u32>(base_address + 0x1EB00000, *data); - size -= 4; - ++src; - reg_addr += 4; + size_in_bytes -= 4; + ++data; + base_address += 4; } } +/// Write a GSP GPU hardware register +void WriteHWRegs(Service::Interface* self) { + u32* cmd_buff = Service::GetCommandBuffer(); + u32 reg_addr = cmd_buff[1]; + u32 size = cmd_buff[2]; + + u32* src = (u32*)Memory::GetPointer(cmd_buff[0x4]); + + WriteHWRegs(reg_addr, size, src); +} + /// Read a GSP GPU hardware register void ReadHWRegs(Service::Interface* self) { u32* cmd_buff = Service::GetCommandBuffer(); |