From 29da6e9ab57a37abafc9c91e00bb01daf451b3ad Mon Sep 17 00:00:00 2001 From: bunnei Date: Wed, 30 Apr 2014 23:46:06 -0400 Subject: added a module to load symbol map files for debugging --- src/core/core.vcxproj | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/core/core.vcxproj') diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index be8448969..a5043ea4b 100644 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -138,6 +138,7 @@ + @@ -171,6 +172,7 @@ + -- cgit v1.2.3 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/CMakeLists.txt | 2 +- src/core/arm/interpreter/armsupp.cpp | 16 ++++----- src/core/core.vcxproj | 4 +-- src/core/core.vcxproj.filters | 12 +++---- src/core/hle/coprocessor.cpp | 64 ++++++++++++++++++++++++++++++++++++ src/core/hle/coprocessor.h | 20 +++++++++++ src/core/hle/mrc.cpp | 64 ------------------------------------ src/core/hle/mrc.h | 20 ----------- 8 files changed, 101 insertions(+), 101 deletions(-) create mode 100644 src/core/hle/coprocessor.cpp create mode 100644 src/core/hle/coprocessor.h delete mode 100644 src/core/hle/mrc.cpp delete mode 100644 src/core/hle/mrc.h (limited to 'src/core/core.vcxproj') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 3308f3c25..88cbabade 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -19,7 +19,7 @@ set(SRCS core.cpp file_sys/directory_file_system.cpp file_sys/meta_file_system.cpp hle/hle.cpp - hle/mrc.cpp + hle/coprocessor.cpp hle/syscall.cpp hle/service/apt.cpp hle/service/gsp.cpp diff --git a/src/core/arm/interpreter/armsupp.cpp b/src/core/arm/interpreter/armsupp.cpp index b2bbedc18..d913c179c 100644 --- a/src/core/arm/interpreter/armsupp.cpp +++ b/src/core/arm/interpreter/armsupp.cpp @@ -20,7 +20,7 @@ //#include "ansidecl.h" #include "skyeye_defs.h" -#include "core/hle/mrc.h" +#include "core/hle/coprocessor.h" #include "core/arm/disassembler/arm_disasm.h" unsigned xscale_cp15_cp_access_allowed (ARMul_State * state, unsigned reg, @@ -663,13 +663,13 @@ ARMul_MCR (ARMul_State * state, ARMword instr, ARMword source) { unsigned cpab; - //printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source); - if (!CP_ACCESS_ALLOWED (state, CPNum)) { - //chy 2004-07-19 should fix in the future ????!!!! - //printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source); - ARMul_UndefInstr (state, instr); - return; - } + ////printf("SKYEYE ARMul_MCR, CPnum is %x, source %x\n",CPNum, source); + //if (!CP_ACCESS_ALLOWED (state, CPNum)) { + // //chy 2004-07-19 should fix in the future ????!!!! + // //printf("SKYEYE ARMul_MCR, ACCESS_not ALLOWed, UndefinedInstr CPnum is %x, source %x\n",CPNum, source); + // ARMul_UndefInstr (state, instr); + // return; + //} cpab = (state->MCR[CPNum]) (state, ARMul_FIRST, instr, source); diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index a5043ea4b..7b8953327 100644 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -153,8 +153,8 @@ + - @@ -193,9 +193,9 @@ + - diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index 9c53f9eff..fabe253ed 100644 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters @@ -105,12 +105,12 @@ hw - - hle - arm\disassembler + + hle + @@ -211,12 +211,12 @@ hw - - hle - arm\disassembler + + hle + 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 diff --git a/src/core/hle/coprocessor.h b/src/core/hle/coprocessor.h new file mode 100644 index 000000000..d6b9f162f --- /dev/null +++ b/src/core/hle/coprocessor.h @@ -0,0 +1,20 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +#include "common/common_types.h" + +namespace HLE { + +/// MRC operations (ARM register from coprocessor), decoded as instr[20:27] +enum ARM11_MRC_OPERATION { + DATA_SYNCHRONIZATION_BARRIER = 0xE0, + CALL_GET_THREAD_COMMAND_BUFFER = 0xE1, +}; + +/// Call an MRC operation in HLE +u32 CallMRC(ARM11_MRC_OPERATION operation); + +} // namespace diff --git a/src/core/hle/mrc.cpp b/src/core/hle/mrc.cpp deleted file mode 100644 index 5223be7c9..000000000 --- a/src/core/hle/mrc.cpp +++ /dev/null @@ -1,64 +0,0 @@ -// 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 diff --git a/src/core/hle/mrc.h b/src/core/hle/mrc.h deleted file mode 100644 index d6b9f162f..000000000 --- a/src/core/hle/mrc.h +++ /dev/null @@ -1,20 +0,0 @@ -// Copyright 2014 Citra Emulator Project -// Licensed under GPLv2 -// Refer to the license.txt file included. - -#pragma once - -#include "common/common_types.h" - -namespace HLE { - -/// MRC operations (ARM register from coprocessor), decoded as instr[20:27] -enum ARM11_MRC_OPERATION { - DATA_SYNCHRONIZATION_BARRIER = 0xE0, - CALL_GET_THREAD_COMMAND_BUFFER = 0xE1, -}; - -/// Call an MRC operation in HLE -u32 CallMRC(ARM11_MRC_OPERATION operation); - -} // namespace -- cgit v1.2.3 From 34dc0a9b0750321d9556ac2e9c57007526096caf Mon Sep 17 00:00:00 2001 From: bunnei Date: Tue, 6 May 2014 23:29:39 -0400 Subject: added config_mem module for HLE of firmware configuration memory settings --- src/core/CMakeLists.txt | 1 + src/core/core.vcxproj | 2 ++ src/core/core.vcxproj.filters | 6 ++++ src/core/hle/config_mem.cpp | 70 +++++++++++++++++++++++++++++++++++++++++++ src/core/hle/config_mem.h | 21 +++++++++++++ 5 files changed, 100 insertions(+) create mode 100644 src/core/hle/config_mem.cpp create mode 100644 src/core/hle/config_mem.h (limited to 'src/core/core.vcxproj') diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 88cbabade..eb4fef381 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -19,6 +19,7 @@ set(SRCS core.cpp file_sys/directory_file_system.cpp file_sys/meta_file_system.cpp hle/hle.cpp + hle/config_mem.cpp hle/coprocessor.cpp hle/syscall.cpp hle/service/apt.cpp diff --git a/src/core/core.vcxproj b/src/core/core.vcxproj index 7b8953327..b56661e48 100644 --- a/src/core/core.vcxproj +++ b/src/core/core.vcxproj @@ -153,6 +153,7 @@ + @@ -193,6 +194,7 @@ + diff --git a/src/core/core.vcxproj.filters b/src/core/core.vcxproj.filters index fabe253ed..5c947ec23 100644 --- a/src/core/core.vcxproj.filters +++ b/src/core/core.vcxproj.filters @@ -111,6 +111,9 @@ hle + + hle + @@ -217,6 +220,9 @@ hle + + hle + diff --git a/src/core/hle/config_mem.cpp b/src/core/hle/config_mem.cpp new file mode 100644 index 000000000..48aa878cc --- /dev/null +++ b/src/core/hle/config_mem.cpp @@ -0,0 +1,70 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#include "common/common_types.h" +#include "common/log.h" + +#include "core/hle/config_mem.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace ConfigMem { + +enum { + KERNEL_VERSIONREVISION = 0x1FF80001, + KERNEL_VERSIONMINOR = 0x1FF80002, + KERNEL_VERSIONMAJOR = 0x1FF80003, + UPDATEFLAG = 0x1FF80004, + NSTID = 0x1FF80008, + SYSCOREVER = 0x1FF80010, + UNITINFO = 0x1FF80014, + KERNEL_CTRSDKVERSION = 0x1FF80018, + APPMEMTYPE = 0x1FF80030, + APPMEMALLOC = 0x1FF80040, + FIRM_VERSIONREVISION = 0x1FF80061, + FIRM_VERSIONMINOR = 0x1FF80062, + FIRM_VERSIONMAJOR = 0x1FF80063, + FIRM_SYSCOREVER = 0x1FF80064, + FIRM_CTRSDKVERSION = 0x1FF80068, +}; + +template +inline void Read(T &var, const u32 addr) { + switch (addr) { + + // Bit 0 set for Retail + case UNITINFO: + var = 0x00000001; + break; + + // Set app memory size to 64MB? + case APPMEMALLOC: + var = 0x04000000; + break; + + // Unknown - normally set to: 0x08000000 - (APPMEMALLOC + *0x1FF80048) + // (Total FCRAM size - APPMEMALLOC - *0x1FF80048) + case 0x1FF80044: + var = 0x08000000 - (0x04000000 + 0x1400000); + break; + + // Unknown - normally set to: 0x1400000 (20MB) + case 0x1FF80048: + var = 0x1400000; + break; + + default: + ERROR_LOG(HLE, "unknown ConfigMem::Read%d @ 0x%08X", sizeof(var) * 8, addr); + } +} + +// Explicitly instantiate template functions because we aren't defining this in the header: + +template void Read(u64 &var, const u32 addr); +template void Read(u32 &var, const u32 addr); +template void Read(u16 &var, const u32 addr); +template void Read(u8 &var, const u32 addr); + + +} // namespace diff --git a/src/core/hle/config_mem.h b/src/core/hle/config_mem.h new file mode 100644 index 000000000..da396a3e6 --- /dev/null +++ b/src/core/hle/config_mem.h @@ -0,0 +1,21 @@ +// Copyright 2014 Citra Emulator Project +// Licensed under GPLv2 +// Refer to the license.txt file included. + +#pragma once + +// Configuration memory stores various hardware/kernel configuration settings. This memory page is +// read-only for ARM11 processes. I'm guessing this would normally be written to by the firmware/ +// bootrom. Because we're not emulating this, and essentially just "stubbing" the functionality, I'm +// putting this as a subset of HLE for now. + +#include "common/common_types.h" + +//////////////////////////////////////////////////////////////////////////////////////////////////// + +namespace ConfigMem { + +template +inline void Read(T &var, const u32 addr); + +} // namespace -- cgit v1.2.3