diff --git a/src/core/hle/kernel/shared_memory.cpp b/src/core/hle/kernel/shared_memory.cpp index 560d3f3aca..f32651d49a 100644 --- a/src/core/hle/kernel/shared_memory.cpp +++ b/src/core/hle/kernel/shared_memory.cpp @@ -142,7 +142,10 @@ ResultCode SharedMemory::Map(Process* target_process, VAddr address, MemoryPermi if (base_address == 0 && target_address == 0) { // Calculate the address at which to map the memory block. - target_address = linear_heap_phys_offset + target_process->GetLinearHeapAreaAddress(); + // Note: even on new firmware versions, the target address is still in the old linear heap + // region. This exception is made to keep the shared font compatibility. See + // APT:GetSharedFont for detail. + target_address = linear_heap_phys_offset + Memory::LINEAR_HEAP_VADDR; } auto vma = target_process->vm_manager.FindVMA(target_address); diff --git a/src/core/hle/service/apt/apt.cpp b/src/core/hle/service/apt/apt.cpp index 741a288e89..44b81a0fd5 100644 --- a/src/core/hle/service/apt/apt.cpp +++ b/src/core/hle/service/apt/apt.cpp @@ -207,10 +207,17 @@ void Module::Interface::GetSharedFont(Kernel::HLERequestContext& ctx) { // The shared font has to be relocated to the new address before being passed to the // application. - auto maybe_vaddr = Memory::PhysicalToVirtualAddress( - apt->shared_font_mem->linear_heap_phys_offset + Memory::FCRAM_PADDR); - ASSERT(maybe_vaddr); - VAddr target_address = *maybe_vaddr; + + // Note: the target address is still in the old linear heap region even on new firmware + // versions. This exception is made for shared font to resolve the following compatibility + // issue: + // The linear heap region changes depending on the kernel version marked in application's + // exheader (not the actual version the application is running on). If an application with old + // kernel version and an applet with new kernel version run at the same time, and they both use + // shared font, different linear heap region would have required shared font to relocate + // according to two different addresses at the same time, which is impossible. + VAddr target_address = + apt->shared_font_mem->linear_heap_phys_offset + Memory::LINEAR_HEAP_VADDR; if (!apt->shared_font_relocated) { BCFNT::RelocateSharedFont(apt->shared_font_mem, target_address); apt->shared_font_relocated = true;