mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-13 22:54:24 -04:00
kern: begin 1.0.0 backwards compat changes (kips run, full boot fails)
This commit is contained in:
parent
e8ffbe630f
commit
49af4fae32
6 changed files with 40 additions and 19 deletions
|
@ -66,6 +66,10 @@ namespace ams::kern {
|
|||
u8 *current = GetPointer<u8>(binary_address + sizeof(InitialProcessBinaryHeader));
|
||||
const u8 * const end = GetPointer<u8>(binary_address + header.size - sizeof(KInitialProcessHeader));
|
||||
|
||||
/* Decide on pools to use. */
|
||||
const auto unsafe_pool = static_cast<KMemoryManager::Pool>(KSystemControl::GetCreateProcessMemoryPool());
|
||||
const auto secure_pool = (GetTargetFirmware() >= TargetFirmware_2_0_0) ? KMemoryManager::Pool_Secure : unsafe_pool;
|
||||
|
||||
const size_t num_processes = header.num_processes;
|
||||
for (size_t i = 0; i < num_processes; i++) {
|
||||
/* Validate that we can read the current KIP. */
|
||||
|
@ -86,7 +90,7 @@ namespace ams::kern {
|
|||
|
||||
/* Allocate memory for the process. */
|
||||
auto &mm = Kernel::GetMemoryManager();
|
||||
const auto pool = reader.UsesSecureMemory() ? KMemoryManager::Pool_System : static_cast<KMemoryManager::Pool>(KSystemControl::GetInitialProcessBinaryPool());
|
||||
const auto pool = reader.UsesSecureMemory() ? secure_pool : unsafe_pool;
|
||||
MESOSPHERE_R_ABORT_UNLESS(mm.Allocate(std::addressof(pg), params.code_num_pages, KMemoryManager::EncodeOption(pool, KMemoryManager::Direction_FromFront)));
|
||||
|
||||
{
|
||||
|
@ -164,7 +168,7 @@ namespace ams::kern {
|
|||
MESOSPHERE_ABORT_UNLESS(Kernel::GetSystemResourceLimit().Reserve(ams::svc::LimitableResource_PhysicalMemoryMax, total_size));
|
||||
|
||||
/* Allocate memory for the image. */
|
||||
const KMemoryManager::Pool pool = static_cast<KMemoryManager::Pool>(KSystemControl::GetInitialProcessBinaryPool());
|
||||
const KMemoryManager::Pool pool = static_cast<KMemoryManager::Pool>(KSystemControl::GetCreateProcessMemoryPool());
|
||||
const auto allocate_option = KMemoryManager::EncodeOption(pool, KMemoryManager::Direction_FromFront);
|
||||
KVirtualAddress allocated_memory = mm.AllocateContinuous(num_pages, 1, allocate_option);
|
||||
MESOSPHERE_ABORT_UNLESS(allocated_memory != Null<KVirtualAddress>);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue