[core] Unstub AliasRegionExtraSize (#260)
This implementation is basically usable for up to 8GB of DRAM which you can set in the emulator. It should ensure that the alias or map region for the virtual address space is bigger when requested. 8GB DRAM is the size of Nintendos DRAM sticks in the developers kit. Going above 8GB DRAM while emulating a game is not recommended. That is why this implementation. Reviewed-on: #260 Reviewed-by: Shinmegumi <shinmegumi@eden-emu.dev> Co-authored-by: SDK-Chan <sdkchan@eden-emu.dev> Co-committed-by: SDK-Chan <sdkchan@eden-emu.dev>
This commit is contained in:
parent
7bfa2404a6
commit
7ce051cfb3
3 changed files with 36 additions and 7 deletions
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
@ -715,6 +718,17 @@ public:
|
|||
return m_address_space_width;
|
||||
}
|
||||
|
||||
size_t CalculateAliasRegionExtraSize() const {
|
||||
const size_t baseline = 64ull << 30; // Mostly appropriate for DRAM values <= 8GB
|
||||
const size_t region = GetAliasRegionSize();
|
||||
|
||||
if (region > baseline) {
|
||||
return region - baseline;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
public:
|
||||
// Linear mapped
|
||||
static u8* GetLinearMappedVirtualPointer(KernelCore& kernel, KPhysicalAddress addr) {
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
@ -410,6 +413,9 @@ public:
|
|||
size_t GetAliasRegionSize() const {
|
||||
return m_page_table.GetAliasRegionSize();
|
||||
}
|
||||
size_t GetAliasRegionExtraSize() const {
|
||||
return m_page_table.CalculateAliasRegionExtraSize();
|
||||
}
|
||||
size_t GetStackRegionSize() const {
|
||||
return m_page_table.GetStackRegionSize();
|
||||
}
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project
|
||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
|
@ -37,8 +40,8 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
|
|||
case InfoType::TotalNonSystemMemorySize:
|
||||
case InfoType::UsedNonSystemMemorySize:
|
||||
case InfoType::IsApplication:
|
||||
case InfoType::FreeThreadCount:
|
||||
case InfoType::AliasRegionExtraSize: {
|
||||
case InfoType::FreeThreadCount:
|
||||
case InfoType::AliasRegionExtraSize: {
|
||||
R_UNLESS(info_sub_id == 0, ResultInvalidEnumValue);
|
||||
|
||||
const auto& handle_table = GetCurrentProcess(system.Kernel()).GetHandleTable();
|
||||
|
@ -61,7 +64,6 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
|
|||
case InfoType::AliasRegionSize:
|
||||
*result = process->GetPageTable().GetAliasRegionSize();
|
||||
R_SUCCEED();
|
||||
|
||||
case InfoType::HeapRegionAddress:
|
||||
*result = GetInteger(process->GetPageTable().GetHeapRegionStart());
|
||||
R_SUCCEED();
|
||||
|
@ -135,10 +137,17 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle
|
|||
}
|
||||
R_SUCCEED();
|
||||
|
||||
case InfoType::AliasRegionExtraSize:
|
||||
// TODO (jarrodnorwell): do this when KIP's NPDM header is finished
|
||||
R_SUCCEED();
|
||||
|
||||
case InfoType::AliasRegionExtraSize: {
|
||||
if (info_sub_id != 0) {
|
||||
return ResultInvalidCombination;
|
||||
}
|
||||
|
||||
KProcess* current_process = GetCurrentProcessPointer(system.Kernel());
|
||||
*result = current_process->GetPageTable().GetAliasRegionExtraSize();
|
||||
|
||||
R_SUCCEED();
|
||||
}
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue