summaryrefslogtreecommitdiff
path: root/src/core/hle/mrc.cpp
diff options
context:
space:
mode:
authorGravatar bunnei2014-04-27 21:25:16 -0400
committerGravatar bunnei2014-04-27 21:25:16 -0400
commit438dba40c1def91e9de252ef05f8650464e5c0c2 (patch)
tree8f323d6095dfefe9d00f34cc4d7229be58a9f409 /src/core/hle/mrc.cpp
parentMerge pull request #4 from cpp3ds/master (diff)
parentremoved DISALLOW_COPY_AND_ASSIGN in favor of NonCopyable class (diff)
downloadyuzu-438dba40c1def91e9de252ef05f8650464e5c0c2.tar.gz
yuzu-438dba40c1def91e9de252ef05f8650464e5c0c2.tar.xz
yuzu-438dba40c1def91e9de252ef05f8650464e5c0c2.zip
Merge branch 'hle-interface-updates'
Diffstat (limited to 'src/core/hle/mrc.cpp')
-rw-r--r--src/core/hle/mrc.cpp64
1 files changed, 64 insertions, 0 deletions
diff --git a/src/core/hle/mrc.cpp b/src/core/hle/mrc.cpp
new file mode 100644
index 000000000..5223be7c9
--- /dev/null
+++ b/src/core/hle/mrc.cpp
@@ -0,0 +1,64 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "core/hle/mrc.h"
6#include "core/hle/hle.h"
7#include "core/mem_map.h"
8#include "core/core.h"
9
10namespace HLE {
11
12enum {
13 CMD_GX_REQUEST_DMA = 0x00000000,
14};
15
16/// Data synchronization barrier
17u32 DataSynchronizationBarrier(u32* command_buffer) {
18 u32 command = command_buffer[0];
19
20 switch (command) {
21
22 case CMD_GX_REQUEST_DMA:
23 {
24 u32* src = (u32*)Memory::GetPointer(command_buffer[1]);
25 u32* dst = (u32*)Memory::GetPointer(command_buffer[2]);
26 u32 size = command_buffer[3];
27 memcpy(dst, src, size);
28 }
29 break;
30
31 default:
32 ERROR_LOG(OSHLE, "MRC::DataSynchronizationBarrier unknown command 0x%08X", command);
33 return -1;
34 }
35
36 return 0;
37}
38
39/// Returns the coprocessor (in this case, syscore) command buffer pointer
40Addr GetThreadCommandBuffer() {
41 // Called on insruction: mrc p15, 0, r0, c13, c0, 3
42 // Returns an address in OSHLE memory for the CPU to read/write to
43 RETURN(CMD_BUFFER_ADDR);
44 return CMD_BUFFER_ADDR;
45}
46
47/// Call an MRC operation in HLE
48u32 CallMRC(ARM11_MRC_OPERATION operation) {
49 switch (operation) {
50
51 case DATA_SYNCHRONIZATION_BARRIER:
52 return DataSynchronizationBarrier((u32*)Memory::GetPointer(PARAM(0)));
53
54 case CALL_GET_THREAD_COMMAND_BUFFER:
55 return GetThreadCommandBuffer();
56
57 default:
58 ERROR_LOG(OSHLE, "unimplemented MRC operation 0x%02X", operation);
59 break;
60 }
61 return -1;
62}
63
64} // namespace