diff options
| author | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-27 12:52:39 -0400 |
|---|---|---|
| committer | Takoroka <137927095+Takoroka@users.noreply.github.com> | 2026-10-27 12:52:39 -0400 |
| commit | fd4e5a855ca208325f8b3e468eb63b1af59319f0 (patch) | |
| tree | 4fead3f2115afab21ffd38c1e22247c1b3b8caff /src | |
| parent | 4441d54b2aa5a3efc2caabed6e40fd40d626d9ae (diff) | |
kernel: svcGetInfo 33 is a page granule; give 29/30 a real region
The SDK checks module address/size against (id33 - 1) when initialising
DSOs, so id 33 is a page granule: return 0x1000. Report ids 29/30 as the
upper half of the alias region (a plausible VAMM address-space region,
backed through MapPhysicalMemory) instead of an empty region.
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/hle/kernel/svc/svc_info.cpp | 26 | ||||
| -rw-r--r-- | src/core/hle/kernel/svc_types.h | 6 |
2 files changed, 18 insertions, 14 deletions
diff --git a/src/core/hle/kernel/svc/svc_info.cpp b/src/core/hle/kernel/svc/svc_info.cpp index aec31ca148..97ad6bbdbc 100644 --- a/src/core/hle/kernel/svc/svc_info.cpp +++ b/src/core/hle/kernel/svc/svc_info.cpp @@ -70,19 +70,23 @@ Result GetInfo(Core::System& system, u64* result, InfoType info_id_type, Handle *result = process->GetPageTable().GetHeapRegionSize(); R_SUCCEED(); case InfoType::Nx2RegionAddress: - // Unknown Switch 2 region; report an empty one just past the alias region. - *result = GetInteger(process->GetPageTable().GetAliasRegionStart()) + - process->GetPageTable().GetAliasRegionSize(); - LOG_WARNING(Kernel_SVC, "(STUBBED) Switch 2 InfoType 29, returning {:#x}", *result); - R_SUCCEED(); - case InfoType::Nx2RegionSize: - LOG_WARNING(Kernel_SVC, "(STUBBED) Switch 2 InfoType 30, returning 0"); - *result = 0; + case InfoType::Nx2RegionSize: { + // Looks like the region Switch 2 VAMM reserves address space in (a title asks for a + // ~7.5 GiB reservation). VAMM backs it with MapPhysicalMemory, which only works in + // the alias region here, so hand out the upper half of the alias region. + auto& page_table = process->GetPageTable(); + const u64 half = page_table.GetAliasRegionSize() / 2; + *result = info_id_type == InfoType::Nx2RegionAddress + ? GetInteger(page_table.GetAliasRegionStart()) + half + : half; + LOG_WARNING(Kernel_SVC, "(STUBBED) Switch 2 InfoType {}, returning {:#x}", + static_cast<u32>(info_id_type), *result); R_SUCCEED(); + } case InfoType::Nx2VammSize: - // Used as the size of VAMM's initial MapPhysicalMemory, so it must be non-zero. - // The real value is unknown; 2 MiB is the smallest size that keeps it block-aligned. - *result = 0x200000; + // A page granule: the SDK checks module addresses/sizes against (value - 1) and + // VAMM maps one granule up front. 4 KiB matches what Switch 1 kernels use. + *result = Core::Memory::YUZU_PAGESIZE; LOG_WARNING(Kernel_SVC, "(STUBBED) Switch 2 InfoType 33, returning {:#x}", *result); R_SUCCEED(); case InfoType::AslrRegionAddress: diff --git a/src/core/hle/kernel/svc_types.h b/src/core/hle/kernel/svc_types.h index 4734522b35..8badaa6b2e 100644 --- a/src/core/hle/kernel/svc_types.h +++ b/src/core/hle/kernel/svc_types.h @@ -158,11 +158,11 @@ enum class InfoType : u32 { IoRegionHint = 27, AliasRegionExtraSize = 28, // Switch 2 kernels: address/size of a region the SDK queries between the alias and - // ASLR regions during nnosInitialize. Meaning not known yet. + // ASLR regions during nnosInitialize; likely the VAMM address-space region. Nx2RegionAddress = 29, Nx2RegionSize = 30, - // Switch 2 kernels: queried by nn::os::detail::VammManager::Initialize and used as the size - // of its first MapPhysicalMemory. Meaning not known yet. + // Switch 2 kernels: a page granule. The SDK aligns module ranges and VAMM's first + // MapPhysicalMemory to it. Nx2VammSize = 33, TransferMemoryHint = 34, |
