summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2014-05-07 21:04:55 -0400
committerGravatar bunnei2014-05-07 21:04:55 -0400
commit72622a1b5a13083e1b4eda3d4584bfa2f04dc55c (patch)
tree1a230947b66fd7001c58f96a47f352532d64e4ec /src
parentadded kernel memory to mem_map (diff)
downloadyuzu-72622a1b5a13083e1b4eda3d4584bfa2f04dc55c.tar.gz
yuzu-72622a1b5a13083e1b4eda3d4584bfa2f04dc55c.tar.xz
yuzu-72622a1b5a13083e1b4eda3d4584bfa2f04dc55c.zip
- 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)
Diffstat (limited to 'src')
-rw-r--r--src/core/hle/coprocessor.cpp34
-rw-r--r--src/core/hle/hle.cpp47
-rw-r--r--src/core/hle/hle.h21
-rw-r--r--src/core/hle/service/apt.cpp2
-rw-r--r--src/core/hle/service/gsp.cpp76
-rw-r--r--src/core/hle/service/service.h12
-rw-r--r--src/core/hle/service/srv.cpp2
-rw-r--r--src/core/mem_map_funcs.cpp22
8 files changed, 100 insertions, 116 deletions
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 @@
9 9
10namespace HLE { 10namespace HLE {
11 11
12enum {
13 CMD_GX_REQUEST_DMA = 0x00000000,
14};
15
16/// Data synchronization barrier 12/// Data synchronization barrier
17u32 DataSynchronizationBarrier(u32* command_buffer) { 13u32 DataSynchronizationBarrier() {
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; 14 return 0;
37} 15}
38 16
39/// Returns the coprocessor (in this case, syscore) command buffer pointer 17/// Returns the coprocessor (in this case, syscore) command buffer pointer
40Addr GetThreadCommandBuffer() { 18Addr GetThreadCommandBuffer() {
41 // Called on insruction: mrc p15, 0, r0, c13, c0, 3 19 // Called on insruction: mrc p15, 0, r0, c13, c0, 3
42 // Returns an address in OSHLE memory for the CPU to read/write to 20 return Memory::KERNEL_MEMORY_VADDR;
43 RETURN(CMD_BUFFER_ADDR);
44 return CMD_BUFFER_ADDR;
45} 21}
46 22
47/// Call an MCR (move to coprocessor from ARM register) instruction in HLE 23/// Call an MCR (move to coprocessor from ARM register) instruction in HLE
@@ -49,7 +25,7 @@ s32 CallMCR(u32 instruction, u32 value) {
49 CoprocessorOperation operation = (CoprocessorOperation)((instruction >> 20) & 0xFF); 25 CoprocessorOperation operation = (CoprocessorOperation)((instruction >> 20) & 0xFF);
50 ERROR_LOG(OSHLE, "unimplemented MCR instruction=0x%08X, operation=%02X, value=%08X", 26 ERROR_LOG(OSHLE, "unimplemented MCR instruction=0x%08X, operation=%02X, value=%08X",
51 instruction, operation, value); 27 instruction, operation, value);
52 return -1; 28 return 0;
53} 29}
54 30
55/// Call an MRC (move to ARM register from coprocessor) instruction in HLE 31/// Call an MRC (move to ARM register from coprocessor) instruction in HLE
@@ -59,7 +35,7 @@ s32 CallMRC(u32 instruction) {
59 switch (operation) { 35 switch (operation) {
60 36
61 case DATA_SYNCHRONIZATION_BARRIER: 37 case DATA_SYNCHRONIZATION_BARRIER:
62 return DataSynchronizationBarrier((u32*)Memory::GetPointer(PARAM(0))); 38 return DataSynchronizationBarrier();
63 39
64 case CALL_GET_THREAD_COMMAND_BUFFER: 40 case CALL_GET_THREAD_COMMAND_BUFFER:
65 return GetThreadCommandBuffer(); 41 return GetThreadCommandBuffer();
@@ -68,7 +44,7 @@ s32 CallMRC(u32 instruction) {
68 ERROR_LOG(OSHLE, "unimplemented MRC instruction 0x%08X", instruction); 44 ERROR_LOG(OSHLE, "unimplemented MRC instruction 0x%08X", instruction);
69 break; 45 break;
70 } 46 }
71 return -1; 47 return 0;
72} 48}
73 49
74} // namespace 50} // namespace
diff --git a/src/core/hle/hle.cpp b/src/core/hle/hle.cpp
index aae9a3943..be151665b 100644
--- a/src/core/hle/hle.cpp
+++ b/src/core/hle/hle.cpp
@@ -15,49 +15,6 @@ namespace HLE {
15 15
16static std::vector<ModuleDef> g_module_db; 16static std::vector<ModuleDef> g_module_db;
17 17
18u8* g_command_buffer = NULL; ///< Command buffer used for sharing between appcore and syscore
19
20// Read from memory used by CTROS HLE functions
21template <typename T>
22inline void Read(T &var, const u32 addr) {
23 if (addr >= HLE::CMD_BUFFER_ADDR && addr < HLE::CMD_BUFFER_ADDR_END) {
24 var = *((const T*)&g_command_buffer[addr & CMD_BUFFER_MASK]);
25 } else {
26 ERROR_LOG(HLE, "unknown read from address %08X", addr);
27 }
28}
29
30// Write to memory used by CTROS HLE functions
31template <typename T>
32inline void Write(u32 addr, const T data) {
33 if (addr >= HLE::CMD_BUFFER_ADDR && addr < HLE::CMD_BUFFER_ADDR_END) {
34 *(T*)&g_command_buffer[addr & CMD_BUFFER_MASK] = data;
35 } else {
36 ERROR_LOG(HLE, "unknown write to address %08X", addr);
37 }
38}
39
40u8 *GetPointer(const u32 addr) {
41 if (addr >= HLE::CMD_BUFFER_ADDR && addr < HLE::CMD_BUFFER_ADDR_END) {
42 return g_command_buffer + (addr & CMD_BUFFER_MASK);
43 } else {
44 ERROR_LOG(HLE, "unknown pointer from address %08X", addr);
45 return 0;
46 }
47}
48
49// Explicitly instantiate template functions because we aren't defining this in the header:
50
51template void Read<u64>(u64 &var, const u32 addr);
52template void Read<u32>(u32 &var, const u32 addr);
53template void Read<u16>(u16 &var, const u32 addr);
54template void Read<u8>(u8 &var, const u32 addr);
55
56template void Write<u64>(u32 addr, const u64 data);
57template void Write<u32>(u32 addr, const u32 data);
58template void Write<u16>(u32 addr, const u16 data);
59template void Write<u8>(u32 addr, const u8 data);
60
61const FunctionDef* GetSyscallInfo(u32 opcode) { 18const FunctionDef* GetSyscallInfo(u32 opcode) {
62 u32 func_num = opcode & 0xFFFFFF; // 8 bits 19 u32 func_num = opcode & 0xFFFFFF; // 8 bits
63 if (func_num > 0xFF) { 20 if (func_num > 0xFF) {
@@ -91,8 +48,6 @@ void RegisterAllModules() {
91 48
92void Init() { 49void Init() {
93 Service::Init(); 50 Service::Init();
94
95 g_command_buffer = new u8[CMD_BUFFER_SIZE];
96 51
97 RegisterAllModules(); 52 RegisterAllModules();
98 53
@@ -102,8 +57,6 @@ void Init() {
102void Shutdown() { 57void Shutdown() {
103 Service::Shutdown(); 58 Service::Shutdown();
104 59
105 delete g_command_buffer;
106
107 g_module_db.clear(); 60 g_module_db.clear();
108 61
109 NOTICE_LOG(HLE, "shutdown OK"); 62 NOTICE_LOG(HLE, "shutdown OK");
diff --git a/src/core/hle/hle.h b/src/core/hle/hle.h
index 907e2d741..42f37e29c 100644
--- a/src/core/hle/hle.h
+++ b/src/core/hle/hle.h
@@ -17,13 +17,6 @@
17 17
18namespace HLE { 18namespace HLE {
19 19
20enum {
21 CMD_BUFFER_ADDR = 0xA0010000, ///< Totally arbitrary unused address space
22 CMD_BUFFER_SIZE = 0x10000,
23 CMD_BUFFER_MASK = (CMD_BUFFER_SIZE - 1),
24 CMD_BUFFER_ADDR_END = (CMD_BUFFER_ADDR + CMD_BUFFER_SIZE),
25};
26
27typedef u32 Addr; 20typedef u32 Addr;
28typedef void (*Func)(); 21typedef void (*Func)();
29 22
@@ -39,20 +32,6 @@ struct ModuleDef {
39 const FunctionDef* func_table; 32 const FunctionDef* func_table;
40}; 33};
41 34
42// Read from memory used by CTROS HLE functions
43template <typename T>
44inline void Read(T &var, const u32 addr);
45
46// Write to memory used by CTROS HLE functions
47template <typename T>
48inline void Write(u32 addr, const T data);
49
50u8* GetPointer(const u32 Address);
51
52inline const char* GetCharPointer(const u32 address) {
53 return (const char *)GetPointer(address);
54}
55
56void RegisterModule(std::string name, int num_functions, const FunctionDef *func_table); 35void RegisterModule(std::string name, int num_functions, const FunctionDef *func_table);
57 36
58void CallSyscall(u32 opcode); 37void CallSyscall(u32 opcode);
diff --git a/src/core/hle/service/apt.cpp b/src/core/hle/service/apt.cpp
index 4a1e8c992..709ac5493 100644
--- a/src/core/hle/service/apt.cpp
+++ b/src/core/hle/service/apt.cpp
@@ -18,7 +18,7 @@ void Initialize(Service::Interface* self) {
18} 18}
19 19
20void GetLockHandle(Service::Interface* self) { 20void GetLockHandle(Service::Interface* self) {
21 u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); 21 u32* cmd_buff = Service::GetCommandBuffer();
22 cmd_buff[5] = 0x00000000; // TODO: This should be an actual mutex handle 22 cmd_buff[5] = 0x00000000; // TODO: This should be an actual mutex handle
23} 23}
24 24
diff --git a/src/core/hle/service/gsp.cpp b/src/core/hle/service/gsp.cpp
index 88c1f1a0f..58df970c4 100644
--- a/src/core/hle/service/gsp.cpp
+++ b/src/core/hle/service/gsp.cpp
@@ -4,6 +4,7 @@
4 4
5 5
6#include "common/log.h" 6#include "common/log.h"
7#include "common/bit_field.h"
7 8
8#include "core/mem_map.h" 9#include "core/mem_map.h"
9#include "core/hle/hle.h" 10#include "core/hle/hle.h"
@@ -12,10 +13,56 @@
12#include "core/hw/lcd.h" 13#include "core/hw/lcd.h"
13 14
14//////////////////////////////////////////////////////////////////////////////////////////////////// 15////////////////////////////////////////////////////////////////////////////////////////////////////
16
17/// GSP shared memory GX command buffer header
18union GX_CmdBufferHeader {
19 u32 hex;
20
21 // Current command index. This index is updated by GSP module after loading the command data,
22 // right before the command is processed. When this index is updated by GSP module, the total
23 // commands field is decreased by one as well.
24 BitField<0,8,u32> index;
25
26 // Total commands to process, must not be value 0 when GSP module handles commands. This must be
27 // <=15 when writing a command to shared memory. This is incremented by the application when
28 // writing a command to shared memory, after increasing this value TriggerCmdReqQueue is only
29 // used if this field is value 1.
30 BitField<8,8,u32> number_commands;
31
32 // Must not be value 1. When the error-code u32 is set, this u8 is set to value 0x80.
33 BitField<16,8,u32> unk_0;
34
35 // Bit 0 must not be set
36 BitField<24,8,u32> unk_1;
37};
38
39/// Gets the address of the start (header) of a command buffer in GSP shared memory
40static inline u32 GX_GetCmdBufferAddress(u32 thread_id) {
41 return (0x10002000 + 0x800 + (thread_id * 0x200));
42}
43
44/// Gets a pointer to the start (header) of a command buffer in GSP shared memory
45static inline u8* GX_GetCmdBufferPointer(u32 thread_id, u32 offset=0) {
46 return Memory::GetPointer(GX_GetCmdBufferAddress(thread_id) + offset);
47}
48
49/// Finishes execution of a GSP command
50void GX_FinishCommand(u32 thread_id) {
51 GX_CmdBufferHeader* header = (GX_CmdBufferHeader*)GX_GetCmdBufferPointer(thread_id);
52 header->number_commands = header->number_commands - 1;
53}
54
55////////////////////////////////////////////////////////////////////////////////////////////////////
15// Namespace GSP_GPU 56// Namespace GSP_GPU
16 57
17namespace GSP_GPU { 58namespace GSP_GPU {
18 59
60u32 g_thread_id = 0;
61
62enum {
63 CMD_GX_REQUEST_DMA = 0x00000000,
64};
65
19enum { 66enum {
20 REG_FRAMEBUFFER_1 = 0x00400468, 67 REG_FRAMEBUFFER_1 = 0x00400468,
21 REG_FRAMEBUFFER_2 = 0x00400494, 68 REG_FRAMEBUFFER_2 = 0x00400494,
@@ -26,7 +73,7 @@ void ReadHWRegs(Service::Interface* self) {
26 static const u32 framebuffer_1[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME1, LCD::PADDR_VRAM_TOP_RIGHT_FRAME1}; 73 static const u32 framebuffer_1[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME1, LCD::PADDR_VRAM_TOP_RIGHT_FRAME1};
27 static const u32 framebuffer_2[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME2, LCD::PADDR_VRAM_TOP_RIGHT_FRAME2}; 74 static const u32 framebuffer_2[] = {LCD::PADDR_VRAM_TOP_LEFT_FRAME2, LCD::PADDR_VRAM_TOP_RIGHT_FRAME2};
28 75
29 u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); 76 u32* cmd_buff = Service::GetCommandBuffer();
30 u32 reg_addr = cmd_buff[1]; 77 u32 reg_addr = cmd_buff[1];
31 u32 size = cmd_buff[2]; 78 u32 size = cmd_buff[2];
32 u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]); 79 u32* dst = (u32*)Memory::GetPointer(cmd_buff[0x41]);
@@ -50,18 +97,37 @@ void ReadHWRegs(Service::Interface* self) {
50 break; 97 break;
51 98
52 default: 99 default:
53 ERROR_LOG(OSHLE, "GSP_GPU::ReadHWRegs unknown register read at address %08X", reg_addr); 100 ERROR_LOG(GSP, "ReadHWRegs unknown register read at address %08X", reg_addr);
54 } 101 }
55 102
56} 103}
57 104
58void RegisterInterruptRelayQueue(Service::Interface* self) { 105void RegisterInterruptRelayQueue(Service::Interface* self) {
59 u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); 106 u32* cmd_buff = Service::GetCommandBuffer();
60 u32 flags = cmd_buff[1]; 107 u32 flags = cmd_buff[1];
61 u32 event_handle = cmd_buff[3]; // TODO(bunnei): Implement event handling 108 u32 event_handle = cmd_buff[3]; // TODO(bunnei): Implement event handling
109
110 cmd_buff[2] = g_thread_id; // ThreadID
62 cmd_buff[4] = self->NewHandle(); 111 cmd_buff[4] = self->NewHandle();
112}
113
114/// This triggers handling of the GX command written to the command buffer in shared memory.
115void TriggerCmdReqQueue(Service::Interface* self) {
116 GX_CmdBufferHeader* header = (GX_CmdBufferHeader*)GX_GetCmdBufferPointer(g_thread_id);
117 u32* cmd_buff = (u32*)GX_GetCmdBufferPointer(g_thread_id, 0x20 + (header->index * 0x20));
63 118
64 return; 119 switch (cmd_buff[0]) {
120
121 // GX request DMA - typically used for copying memory from GSP heap to VRAM
122 case CMD_GX_REQUEST_DMA:
123 memcpy(Memory::GetPointer(cmd_buff[2]), Memory::GetPointer(cmd_buff[1]), cmd_buff[3]);
124 break;
125
126 default:
127 ERROR_LOG(GSP, "TriggerCmdReqQueue unknown command 0x%08X", cmd_buff[0]);
128 }
129
130 GX_FinishCommand(g_thread_id);
65} 131}
66 132
67const Interface::FunctionInfo FunctionTable[] = { 133const Interface::FunctionInfo FunctionTable[] = {
@@ -76,7 +142,7 @@ const Interface::FunctionInfo FunctionTable[] = {
76 {0x00090082, NULL, "InvalidateDataCache"}, 142 {0x00090082, NULL, "InvalidateDataCache"},
77 {0x000A0044, NULL, "RegisterInterruptEvents"}, 143 {0x000A0044, NULL, "RegisterInterruptEvents"},
78 {0x000B0040, NULL, "SetLcdForceBlack"}, 144 {0x000B0040, NULL, "SetLcdForceBlack"},
79 {0x000C0000, NULL, "TriggerCmdReqQueue"}, 145 {0x000C0000, TriggerCmdReqQueue, "TriggerCmdReqQueue"},
80 {0x000D0140, NULL, "SetDisplayTransfer"}, 146 {0x000D0140, NULL, "SetDisplayTransfer"},
81 {0x000E0180, NULL, "SetTextureCopy"}, 147 {0x000E0180, NULL, "SetTextureCopy"},
82 {0x000F0200, NULL, "SetMemoryFill"}, 148 {0x000F0200, NULL, "SetMemoryFill"},
diff --git a/src/core/hle/service/service.h b/src/core/hle/service/service.h
index b79dc9458..b260a290a 100644
--- a/src/core/hle/service/service.h
+++ b/src/core/hle/service/service.h
@@ -10,6 +10,7 @@
10 10
11#include "common/common.h" 11#include "common/common.h"
12#include "common/common_types.h" 12#include "common/common_types.h"
13#include "core/mem_map.h"
13#include "core/hle/syscall.h" 14#include "core/hle/syscall.h"
14 15
15//////////////////////////////////////////////////////////////////////////////////////////////////// 16////////////////////////////////////////////////////////////////////////////////////////////////////
@@ -22,6 +23,15 @@ typedef s32 NativeUID; ///< Native handle for a service
22static const int kMaxPortSize = 0x08; ///< Maximum size of a port name (8 characters) 23static const int kMaxPortSize = 0x08; ///< Maximum size of a port name (8 characters)
23static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header 24static const int kCommandHeaderOffset = 0x80; ///< Offset into command buffer of header
24 25
26/**
27 * Returns a pointer to the command buffer in kernel memory
28 * @param offset Optional offset into command buffer
29 * @return Pointer to command buffer
30 */
31inline static u32* GetCommandBuffer(const int offset=0) {
32 return (u32*)Memory::GetPointer(Memory::KERNEL_MEMORY_VADDR + kCommandHeaderOffset + offset);
33}
34
25class Manager; 35class Manager;
26 36
27/// Interface to a CTROS service 37/// Interface to a CTROS service
@@ -81,7 +91,7 @@ public:
81 * @return Return result of svcSendSyncRequest passed back to user app 91 * @return Return result of svcSendSyncRequest passed back to user app
82 */ 92 */
83 Syscall::Result Sync() { 93 Syscall::Result Sync() {
84 u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + kCommandHeaderOffset); 94 u32* cmd_buff = GetCommandBuffer();
85 auto itr = m_functions.find(cmd_buff[0]); 95 auto itr = m_functions.find(cmd_buff[0]);
86 96
87 if (itr == m_functions.end()) { 97 if (itr == m_functions.end()) {
diff --git a/src/core/hle/service/srv.cpp b/src/core/hle/service/srv.cpp
index 9437868c5..071741444 100644
--- a/src/core/hle/service/srv.cpp
+++ b/src/core/hle/service/srv.cpp
@@ -18,7 +18,7 @@ void Initialize(Service::Interface* self) {
18 18
19void GetServiceHandle(Service::Interface* self) { 19void GetServiceHandle(Service::Interface* self) {
20 Syscall::Result res = 0; 20 Syscall::Result res = 0;
21 u32* cmd_buff = (u32*)HLE::GetPointer(HLE::CMD_BUFFER_ADDR + Service::kCommandHeaderOffset); 21 u32* cmd_buff = Service::GetCommandBuffer();
22 22
23 std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize); 23 std::string port_name = std::string((const char*)&cmd_buff[1], 0, Service::kMaxPortSize);
24 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name); 24 Service::Interface* service = Service::g_manager->FetchFromPortName(port_name);
diff --git a/src/core/mem_map_funcs.cpp b/src/core/mem_map_funcs.cpp
index 4812a8d22..8ab647714 100644
--- a/src/core/mem_map_funcs.cpp
+++ b/src/core/mem_map_funcs.cpp
@@ -48,11 +48,9 @@ inline void _Read(T &var, const u32 addr) {
48 48
49 const u32 vaddr = _VirtualAddress(addr); 49 const u32 vaddr = _VirtualAddress(addr);
50 50
51 // Memory allocated for HLE use that can be addressed from the emulated application 51 // Kernel memory command buffer
52 // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE 52 if (vaddr >= KERNEL_MEMORY_VADDR && vaddr < KERNEL_MEMORY_VADDR_END) {
53 // core running the user application (appcore) 53 var = *((const T*)&g_kernel_mem[vaddr & KERNEL_MEMORY_MASK]);
54 if (vaddr >= HLE::CMD_BUFFER_ADDR && vaddr < HLE::CMD_BUFFER_ADDR_END) {
55 HLE::Read<T>(var, vaddr);
56 54
57 // Hardware I/O register reads 55 // Hardware I/O register reads
58 // 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space 56 // 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
@@ -92,11 +90,9 @@ template <typename T>
92inline void _Write(u32 addr, const T data) { 90inline void _Write(u32 addr, const T data) {
93 u32 vaddr = _VirtualAddress(addr); 91 u32 vaddr = _VirtualAddress(addr);
94 92
95 // Memory allocated for HLE use that can be addressed from the emulated application 93 // Kernel memory command buffer
96 // The primary use of this is sharing a commandbuffer between the HLE OS (syscore) and the LLE 94 if (vaddr >= KERNEL_MEMORY_VADDR && vaddr < KERNEL_MEMORY_VADDR_END) {
97 // core running the user application (appcore) 95 *(T*)&g_kernel_mem[vaddr & KERNEL_MEMORY_MASK] = data;
98 if (vaddr >= HLE::CMD_BUFFER_ADDR && vaddr < HLE::CMD_BUFFER_ADDR_END) {
99 HLE::Write<T>(vaddr, data);
100 96
101 // Hardware I/O register writes 97 // Hardware I/O register writes
102 // 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space 98 // 0x10XXXXXX- is physical address space, 0x1EXXXXXX is virtual address space
@@ -140,8 +136,12 @@ inline void _Write(u32 addr, const T data) {
140u8 *GetPointer(const u32 addr) { 136u8 *GetPointer(const u32 addr) {
141 const u32 vaddr = _VirtualAddress(addr); 137 const u32 vaddr = _VirtualAddress(addr);
142 138
139 // Kernel memory command buffer
140 if (vaddr >= KERNEL_MEMORY_VADDR && vaddr < KERNEL_MEMORY_VADDR_END) {
141 return g_kernel_mem + (vaddr & KERNEL_MEMORY_MASK);
142
143 // ExeFS:/.code is loaded here 143 // ExeFS:/.code is loaded here
144 if ((vaddr >= EXEFS_CODE_VADDR) && (vaddr < EXEFS_CODE_VADDR_END)) { 144 } else if ((vaddr >= EXEFS_CODE_VADDR) && (vaddr < EXEFS_CODE_VADDR_END)) {
145 return g_exefs_code + (vaddr & EXEFS_CODE_MASK); 145 return g_exefs_code + (vaddr & EXEFS_CODE_MASK);
146 146
147 // FCRAM - GSP heap 147 // FCRAM - GSP heap