hle: kernel: k_system_control: Add GetRealMemorySize and update GetKernelPhysicalBaseAddress.
This commit is contained in:
parent
18e77a54c3
commit
9b5e7971dc
|
@ -39,6 +39,10 @@ Smc::MemoryArrangement GetMemoryArrangeForInit() {
|
||||||
}
|
}
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
|
size_t KSystemControl::Init::GetRealMemorySize() {
|
||||||
|
return GetIntendedMemorySize();
|
||||||
|
}
|
||||||
|
|
||||||
// Initialization.
|
// Initialization.
|
||||||
size_t KSystemControl::Init::GetIntendedMemorySize() {
|
size_t KSystemControl::Init::GetIntendedMemorySize() {
|
||||||
switch (GetMemorySizeForInit()) {
|
switch (GetMemorySizeForInit()) {
|
||||||
|
@ -53,7 +57,13 @@ size_t KSystemControl::Init::GetIntendedMemorySize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
PAddr KSystemControl::Init::GetKernelPhysicalBaseAddress(u64 base_address) {
|
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() {
|
bool KSystemControl::Init::ShouldIncreaseThreadResourceLimit() {
|
||||||
|
|
|
@ -13,6 +13,7 @@ public:
|
||||||
class Init {
|
class Init {
|
||||||
public:
|
public:
|
||||||
// Initialization.
|
// Initialization.
|
||||||
|
static std::size_t GetRealMemorySize();
|
||||||
static std::size_t GetIntendedMemorySize();
|
static std::size_t GetIntendedMemorySize();
|
||||||
static PAddr GetKernelPhysicalBaseAddress(u64 base_address);
|
static PAddr GetKernelPhysicalBaseAddress(u64 base_address);
|
||||||
static bool ShouldIncreaseThreadResourceLimit();
|
static bool ShouldIncreaseThreadResourceLimit();
|
||||||
|
|
Loading…
Reference in New Issue