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

Support for PhysicalMemory SVCs #503

Open
fincs opened this issue Nov 7, 2020 · 3 comments
Open

Support for PhysicalMemory SVCs #503

fincs opened this issue Nov 7, 2020 · 3 comments

Comments

@fincs
Copy link
Contributor

fincs commented Nov 7, 2020

In version 3.0 of the Horizon kernel, new memory management SVCs were added. These essentially implement a new, more flexible take on heap management. Newer official software is known to take advantage of this improved heap management system. As a result, it would be desirable to add support for PhysicalMemory SVCs to libnx so that homebrew can take advantage of it.

Adding support involves redesigning how libnx applications interact with the homebrew environment (specifically nx-hbloader), and also figuring out a way to fall back on older style svcSetHeapSize heap management on systems running older Horizon kernels. Also note that Mesosphère implements all newer Horizon kernel functionality regardless of the installed firmware version; and a future version of Atmosphère will unconditionally have Mesosphère enabled, therefore making this a non-issue.

@DCNick3
Copy link

DCNick3 commented May 9, 2021

Well, it seems that now Mesosphère is close to being unconditionally enabled.. Can you please look at this?

It seems that it might break a lot of stuff... Heap overrides are already in the ABI...

Also a relevant place to look at: https://github.com/devkitPro/newlib/blob/devkitA64/libgloss/libsysbase/sbrk.c.

sbrk emulation for windows using virtual memory APIs in newlib: https://github.com/devkitPro/newlib/blob/a60a4501b77dca8f30e01327b96171ee89c278f7/newlib/libc/stdlib/mallocr.c#L1170 (may be used as reference if & when implementing sbrk emulation).

Just FYI: I would like to help with implementation of this if it would be of any use.

@Bulmanator
Copy link

Hello, I was wondering if there was an update to this?
As of Atmosphère 1.0.0 from what I can tell Mesosphère is no longer opt-out and thus unconditionally enabled.

It would be nice to be able to use generic virtual memory in homebrew applications to align with PC counterparts like VirtualAlloc/mmap (that said, I haven't wrapped my head around SVC call stuff, so this might not even be what I think it is)

@xfreshx
Copy link

xfreshx commented Apr 5, 2023

Yes, having mmap is somestging I do need for a port of X-Ray game engine (open source version of famous S.T.A.L.K.E.R game engine). Would you provide any update please?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants