Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow plugins with heaps of 5 MiB or less to use PRIVATE memory instead of SHARED #2079

Closed
wants to merge 7 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion sysmodules/rosalina/source/plugin/memoryblock.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,13 @@ Result MemoryBlock__UnmountFromProcess(void)
{
Handle target = PluginLoaderCtx.target;
PluginHeader *header = &PluginLoaderCtx.header;
MemoryBlock *memblock = &PluginLoaderCtx.memblock;

Result res = 0;

res = svcUnmapProcessMemoryEx(target, 0x07000000, header->exeSize);
res = svcMapProcessMemoryEx(target, header->heapVA, CUR_PROCESS_HANDLE, (u32) memblock->memblock + header->exeSize, header->heapSize, true);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the logic behind this change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

https://github.com/LittlestCube/Luma3DS/blob/48cf6596b16a62aa6fe09d4008d18fe1624a1dee/sysmodules/rosalina/source/plugin/memoryblock.c#L246-L249

Probably doesn't matter now, but two lines under you can see both original Unmaps were kept. The idea was to make sure it was still mapped the normal way with 0x5806 just in case Unmap would somehow break on PRIVATE memory.

Admittedly, perhaps a call to svcControlProcessMemory would have been more prudent, but I'm not sure.


res |= svcUnmapProcessMemoryEx(target, 0x07000000, header->exeSize);
res |= svcUnmapProcessMemoryEx(target, header->heapVA, header->heapSize);

return res;
Expand Down