summaryrefslogtreecommitdiffstats
path: root/src/core/hle/kernel/board
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2022-02-22 02:05:19 +0100
committerbunnei <bunneidev@gmail.com>2022-02-27 19:34:02 +0100
commit9b5e7971dc3b31721499cd44ffd049132718c49f (patch)
tree87970581bcb00a92bd223cbbe5e18ec40500a5a6 /src/core/hle/kernel/board
parenthle: kernel: k_memory_layout: Add GetPhysicalLinearRegion. (diff)
downloadyuzu-9b5e7971dc3b31721499cd44ffd049132718c49f.tar
yuzu-9b5e7971dc3b31721499cd44ffd049132718c49f.tar.gz
yuzu-9b5e7971dc3b31721499cd44ffd049132718c49f.tar.bz2
yuzu-9b5e7971dc3b31721499cd44ffd049132718c49f.tar.lz
yuzu-9b5e7971dc3b31721499cd44ffd049132718c49f.tar.xz
yuzu-9b5e7971dc3b31721499cd44ffd049132718c49f.tar.zst
yuzu-9b5e7971dc3b31721499cd44ffd049132718c49f.zip
Diffstat (limited to 'src/core/hle/kernel/board')
-rw-r--r--src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp12
-rw-r--r--src/core/hle/kernel/board/nintendo/nx/k_system_control.h1
2 files changed, 12 insertions, 1 deletions
diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
index 702cacffc..8027bec00 100644
--- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
+++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.cpp
@@ -39,6 +39,10 @@ Smc::MemoryArrangement GetMemoryArrangeForInit() {
}
} // namespace
+size_t KSystemControl::Init::GetRealMemorySize() {
+ return GetIntendedMemorySize();
+}
+
// Initialization.
size_t KSystemControl::Init::GetIntendedMemorySize() {
switch (GetMemorySizeForInit()) {
@@ -53,7 +57,13 @@ size_t KSystemControl::Init::GetIntendedMemorySize() {
}
PAddr KSystemControl::Init::GetKernelPhysicalBaseAddress(u64 base_address) {
- return base_address;
+ const size_t real_dram_size = KSystemControl::Init::GetRealMemorySize();
+ const size_t intended_dram_size = KSystemControl::Init::GetIntendedMemorySize();
+ if (intended_dram_size * 2 < real_dram_size) {
+ return base_address;
+ } else {
+ return base_address + ((real_dram_size - intended_dram_size) / 2);
+ }
}
bool KSystemControl::Init::ShouldIncreaseThreadResourceLimit() {
diff --git a/src/core/hle/kernel/board/nintendo/nx/k_system_control.h b/src/core/hle/kernel/board/nintendo/nx/k_system_control.h
index 52f230ced..df2a17f2a 100644
--- a/src/core/hle/kernel/board/nintendo/nx/k_system_control.h
+++ b/src/core/hle/kernel/board/nintendo/nx/k_system_control.h
@@ -13,6 +13,7 @@ public:
class Init {
public:
// Initialization.
+ static std::size_t GetRealMemorySize();
static std::size_t GetIntendedMemorySize();
static PAddr GetKernelPhysicalBaseAddress(u64 base_address);
static bool ShouldIncreaseThreadResourceLimit();