summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGravatar bunnei2014-05-06 23:29:39 -0400
committerGravatar bunnei2014-05-06 23:29:39 -0400
commit34dc0a9b0750321d9556ac2e9c57007526096caf (patch)
treea6f1ab57383d4ea68060462c69ce5ce0dc59aa8a /src
parent- disable strict alignment on LDRD/STRD (diff)
downloadyuzu-34dc0a9b0750321d9556ac2e9c57007526096caf.tar.gz
yuzu-34dc0a9b0750321d9556ac2e9c57007526096caf.tar.xz
yuzu-34dc0a9b0750321d9556ac2e9c57007526096caf.zip
added config_mem module for HLE of firmware configuration memory settings
Diffstat (limited to '')
-rw-r--r--src/core/CMakeLists.txt1
-rw-r--r--src/core/core.vcxproj2
-rw-r--r--src/core/core.vcxproj.filters6
-rw-r--r--src/core/hle/config_mem.cpp70
-rw-r--r--src/core/hle/config_mem.h21
5 files changed, 100 insertions, 0 deletions
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
19 file_sys/directory_file_system.cpp 19 file_sys/directory_file_system.cpp
20 file_sys/meta_file_system.cpp 20 file_sys/meta_file_system.cpp
21 hle/hle.cpp 21 hle/hle.cpp
22 hle/config_mem.cpp
22 hle/coprocessor.cpp 23 hle/coprocessor.cpp
23 hle/syscall.cpp 24 hle/syscall.cpp
24 hle/service/apt.cpp 25 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 @@
153 <ClCompile Include="elf\elf_reader.cpp" /> 153 <ClCompile Include="elf\elf_reader.cpp" />
154 <ClCompile Include="file_sys\directory_file_system.cpp" /> 154 <ClCompile Include="file_sys\directory_file_system.cpp" />
155 <ClCompile Include="file_sys\meta_file_system.cpp" /> 155 <ClCompile Include="file_sys\meta_file_system.cpp" />
156 <ClCompile Include="hle\config_mem.cpp" />
156 <ClCompile Include="hle\coprocessor.cpp" /> 157 <ClCompile Include="hle\coprocessor.cpp" />
157 <ClCompile Include="hle\hle.cpp" /> 158 <ClCompile Include="hle\hle.cpp" />
158 <ClCompile Include="hle\service\apt.cpp" /> 159 <ClCompile Include="hle\service\apt.cpp" />
@@ -193,6 +194,7 @@
193 <ClInclude Include="file_sys\directory_file_system.h" /> 194 <ClInclude Include="file_sys\directory_file_system.h" />
194 <ClInclude Include="file_sys\file_sys.h" /> 195 <ClInclude Include="file_sys\file_sys.h" />
195 <ClInclude Include="file_sys\meta_file_system.h" /> 196 <ClInclude Include="file_sys\meta_file_system.h" />
197 <ClInclude Include="hle\config_mem.h" />
196 <ClInclude Include="hle\coprocessor.h" /> 198 <ClInclude Include="hle\coprocessor.h" />
197 <ClInclude Include="hle\function_wrappers.h" /> 199 <ClInclude Include="hle\function_wrappers.h" />
198 <ClInclude Include="hle\hle.h" /> 200 <ClInclude Include="hle\hle.h" />
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 @@
111 <ClCompile Include="hle\coprocessor.cpp"> 111 <ClCompile Include="hle\coprocessor.cpp">
112 <Filter>hle</Filter> 112 <Filter>hle</Filter>
113 </ClCompile> 113 </ClCompile>
114 <ClCompile Include="hle\config_mem.cpp">
115 <Filter>hle</Filter>
116 </ClCompile>
114 </ItemGroup> 117 </ItemGroup>
115 <ItemGroup> 118 <ItemGroup>
116 <ClInclude Include="arm\disassembler\arm_disasm.h"> 119 <ClInclude Include="arm\disassembler\arm_disasm.h">
@@ -217,6 +220,9 @@
217 <ClInclude Include="hle\coprocessor.h"> 220 <ClInclude Include="hle\coprocessor.h">
218 <Filter>hle</Filter> 221 <Filter>hle</Filter>
219 </ClInclude> 222 </ClInclude>
223 <ClInclude Include="hle\config_mem.h">
224 <Filter>hle</Filter>
225 </ClInclude>
220 </ItemGroup> 226 </ItemGroup>
221 <ItemGroup> 227 <ItemGroup>
222 <Text Include="CMakeLists.txt" /> 228 <Text Include="CMakeLists.txt" />
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 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#include "common/common_types.h"
6#include "common/log.h"
7
8#include "core/hle/config_mem.h"
9
10////////////////////////////////////////////////////////////////////////////////////////////////////
11
12namespace ConfigMem {
13
14enum {
15 KERNEL_VERSIONREVISION = 0x1FF80001,
16 KERNEL_VERSIONMINOR = 0x1FF80002,
17 KERNEL_VERSIONMAJOR = 0x1FF80003,
18 UPDATEFLAG = 0x1FF80004,
19 NSTID = 0x1FF80008,
20 SYSCOREVER = 0x1FF80010,
21 UNITINFO = 0x1FF80014,
22 KERNEL_CTRSDKVERSION = 0x1FF80018,
23 APPMEMTYPE = 0x1FF80030,
24 APPMEMALLOC = 0x1FF80040,
25 FIRM_VERSIONREVISION = 0x1FF80061,
26 FIRM_VERSIONMINOR = 0x1FF80062,
27 FIRM_VERSIONMAJOR = 0x1FF80063,
28 FIRM_SYSCOREVER = 0x1FF80064,
29 FIRM_CTRSDKVERSION = 0x1FF80068,
30};
31
32template <typename T>
33inline void Read(T &var, const u32 addr) {
34 switch (addr) {
35
36 // Bit 0 set for Retail
37 case UNITINFO:
38 var = 0x00000001;
39 break;
40
41 // Set app memory size to 64MB?
42 case APPMEMALLOC:
43 var = 0x04000000;
44 break;
45
46 // Unknown - normally set to: 0x08000000 - (APPMEMALLOC + *0x1FF80048)
47 // (Total FCRAM size - APPMEMALLOC - *0x1FF80048)
48 case 0x1FF80044:
49 var = 0x08000000 - (0x04000000 + 0x1400000);
50 break;
51
52 // Unknown - normally set to: 0x1400000 (20MB)
53 case 0x1FF80048:
54 var = 0x1400000;
55 break;
56
57 default:
58 ERROR_LOG(HLE, "unknown ConfigMem::Read%d @ 0x%08X", sizeof(var) * 8, addr);
59 }
60}
61
62// Explicitly instantiate template functions because we aren't defining this in the header:
63
64template void Read<u64>(u64 &var, const u32 addr);
65template void Read<u32>(u32 &var, const u32 addr);
66template void Read<u16>(u16 &var, const u32 addr);
67template void Read<u8>(u8 &var, const u32 addr);
68
69
70} // 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 @@
1// Copyright 2014 Citra Emulator Project
2// Licensed under GPLv2
3// Refer to the license.txt file included.
4
5#pragma once
6
7// Configuration memory stores various hardware/kernel configuration settings. This memory page is
8// read-only for ARM11 processes. I'm guessing this would normally be written to by the firmware/
9// bootrom. Because we're not emulating this, and essentially just "stubbing" the functionality, I'm
10// putting this as a subset of HLE for now.
11
12#include "common/common_types.h"
13
14////////////////////////////////////////////////////////////////////////////////////////////////////
15
16namespace ConfigMem {
17
18template <typename T>
19inline void Read(T &var, const u32 addr);
20
21} // namespace