From f0434249150f27d7921a57f70d6af11c12c4e08f Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 1 May 2014 19:20:44 -0400 Subject: renamed hle "mrc" module to "coprocessor" --- src/core/hle/coprocessor.cpp | 64 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 src/core/hle/coprocessor.cpp (limited to 'src/core/hle/coprocessor.cpp') diff --git a/src/core/hle/coprocessor.cpp b/src/core/hle/coprocessor.cpp new file mode 100644 index 000000000..5223be7c9 --- /dev/null +++ b/src/core/hle/coprocessor.cpp @@ -0,0 +1,64 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "core/hle/mrc.h" +#include "core/hle/hle.h" +#include "core/mem_map.h" +#include "core/core.h" + +namespace HLE { + +enum { + CMD_GX_REQUEST_DMA = 0x00000000, +}; + +/// Data synchronization barrier +u32 DataSynchronizationBarrier(u32* command_buffer) { + u32 command = command_buffer[0]; + + switch (command) { + + case CMD_GX_REQUEST_DMA: + { + u32* src = (u32*)Memory::GetPointer(command_buffer[1]); + u32* dst = (u32*)Memory::GetPointer(command_buffer[2]); + u32 size = command_buffer[3]; + memcpy(dst, src, size); + } + break; + + default: + ERROR_LOG(OSHLE, "MRC::DataSynchronizationBarrier unknown command 0x%08X", command); + return -1; + } + + return 0; +} + +/// Returns the coprocessor (in this case, syscore) command buffer pointer +Addr GetThreadCommandBuffer() { + // Called on insruction: mrc p15, 0, r0, c13, c0, 3 + // Returns an address in OSHLE memory for the CPU to read/write to + RETURN(CMD_BUFFER_ADDR); + return CMD_BUFFER_ADDR; +} + +/// Call an MRC operation in HLE +u32 CallMRC(ARM11_MRC_OPERATION operation) { + switch (operation) { + + case DATA_SYNCHRONIZATION_BARRIER: + return DataSynchronizationBarrier((u32*)Memory::GetPointer(PARAM(0))); + + case CALL_GET_THREAD_COMMAND_BUFFER: + return GetThreadCommandBuffer(); + + default: + ERROR_LOG(OSHLE, "unimplemented MRC operation 0x%02X", operation); + break; + } + return -1; +} + +} // namespace -- cgit v1.2.3 From c1e71ae1ac6700e2e849c59e55baeacda7a20ae6 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 1 May 2014 19:21:04 -0400 Subject: fixed include in coprocessor.cpp --- src/core/hle/coprocessor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/core/hle/coprocessor.cpp') diff --git a/src/core/hle/coprocessor.cpp b/src/core/hle/coprocessor.cpp index 5223be7c9..5b412c586 100644 --- a/src/core/hle/coprocessor.cpp +++ b/src/core/hle/coprocessor.cpp @@ -2,7 +2,7 @@ // Licensed under GPLv2 // Refer to the license.txt file included. -#include "core/hle/mrc.h" +#include "core/hle/coprocessor.h" #include "core/hle/hle.h" #include "core/mem_map.h" #include "core/core.h" -- cgit v1.2.3 From f7c6302009aa2453c37a6a7a3b1af4843f620078 Mon Sep 17 00:00:00 2001 From: bunnei Date: Thu, 1 May 2014 23:03:50 -0400 Subject: - added CallMCR function to coprocessor HLE module - moved instruction decoding to coprocessor HLE module --- src/core/hle/coprocessor.cpp | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/core/hle/coprocessor.cpp') diff --git a/src/core/hle/coprocessor.cpp b/src/core/hle/coprocessor.cpp index 5b412c586..df1362176 100644 --- a/src/core/hle/coprocessor.cpp +++ b/src/core/hle/coprocessor.cpp @@ -44,8 +44,18 @@ Addr GetThreadCommandBuffer() { return CMD_BUFFER_ADDR; } -/// Call an MRC operation in HLE -u32 CallMRC(ARM11_MRC_OPERATION operation) { +/// Call an MCR (move to coprocessor from ARM register) instruction in HLE +s32 CallMCR(u32 instruction, u32 value) { + CoprocessorOperation operation = (CoprocessorOperation)((instruction >> 20) & 0xFF); + ERROR_LOG(OSHLE, "unimplemented MCR instruction=0x%08X, operation=%02X, value=%08X", + instruction, operation, value); + return -1; +} + +/// Call an MRC (move to ARM register from coprocessor) instruction in HLE +s32 CallMRC(u32 instruction) { + CoprocessorOperation operation = (CoprocessorOperation)((instruction >> 20) & 0xFF); + switch (operation) { case DATA_SYNCHRONIZATION_BARRIER: @@ -55,7 +65,7 @@ u32 CallMRC(ARM11_MRC_OPERATION operation) { return GetThreadCommandBuffer(); default: - ERROR_LOG(OSHLE, "unimplemented MRC operation 0x%02X", operation); + ERROR_LOG(OSHLE, "unimplemented MRC instruction 0x%08X", instruction); break; } return -1; -- cgit v1.2.3 From 72622a1b5a13083e1b4eda3d4584bfa2f04dc55c Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 7 May 2014 21:04:55 -0400 Subject: - removed HLE mem "hack" and replaced with kernel mem region - added a helper function for getting command buffer for services - fixed bug where GSP DMA was incorrectly being done in DataSynchronizationBarrier (instead of gsp_TriggerCmdReqQueue) --- src/core/hle/coprocessor.cpp | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) (limited to 'src/core/hle/coprocessor.cpp') diff --git a/src/core/hle/coprocessor.cpp b/src/core/hle/coprocessor.cpp index df1362176..74305331c 100644 --- a/src/core/hle/coprocessor.cpp +++ b/src/core/hle/coprocessor.cpp @@ -9,39 +9,15 @@ namespace HLE { -enum { - CMD_GX_REQUEST_DMA = 0x00000000, -}; - /// Data synchronization barrier -u32 DataSynchronizationBarrier(u32* command_buffer) { - u32 command = command_buffer[0]; - - switch (command) { - - case CMD_GX_REQUEST_DMA: - { - u32* src = (u32*)Memory::GetPointer(command_buffer[1]); - u32* dst = (u32*)Memory::GetPointer(command_buffer[2]); - u32 size = command_buffer[3]; - memcpy(dst, src, size); - } - break; - - default: - ERROR_LOG(OSHLE, "MRC::DataSynchronizationBarrier unknown command 0x%08X", command); - return -1; - } - +u32 DataSynchronizationBarrier() { return 0; } /// Returns the coprocessor (in this case, syscore) command buffer pointer Addr GetThreadCommandBuffer() { // Called on insruction: mrc p15, 0, r0, c13, c0, 3 - // Returns an address in OSHLE memory for the CPU to read/write to - RETURN(CMD_BUFFER_ADDR); - return CMD_BUFFER_ADDR; + return Memory::KERNEL_MEMORY_VADDR; } /// Call an MCR (move to coprocessor from ARM register) instruction in HLE @@ -49,7 +25,7 @@ s32 CallMCR(u32 instruction, u32 value) { CoprocessorOperation operation = (CoprocessorOperation)((instruction >> 20) & 0xFF); ERROR_LOG(OSHLE, "unimplemented MCR instruction=0x%08X, operation=%02X, value=%08X", instruction, operation, value); - return -1; + return 0; } /// Call an MRC (move to ARM register from coprocessor) instruction in HLE @@ -59,7 +35,7 @@ s32 CallMRC(u32 instruction) { switch (operation) { case DATA_SYNCHRONIZATION_BARRIER: - return DataSynchronizationBarrier((u32*)Memory::GetPointer(PARAM(0))); + return DataSynchronizationBarrier(); case CALL_GET_THREAD_COMMAND_BUFFER: return GetThreadCommandBuffer(); @@ -68,7 +44,7 @@ s32 CallMRC(u32 instruction) { ERROR_LOG(OSHLE, "unimplemented MRC instruction 0x%08X", instruction); break; } - return -1; + return 0; } } // namespace -- cgit v1.2.3