Kernel, APT: SharedFont/SharedMemoryOnSharedDevice should always use old linear heap VAddr
This commit is contained in:
parent
1444d60109
commit
8c65433ab5
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue