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

Add some non-zero SystemResourceSize to NPDM #35

Open
DCNick3 opened this issue Nov 1, 2020 · 8 comments
Open

Add some non-zero SystemResourceSize to NPDM #35

DCNick3 opened this issue Nov 1, 2020 · 8 comments

Comments

@DCNick3
Copy link

DCNick3 commented Nov 1, 2020

As for now, all homebrew apps are ran with SystemResourceSize = 0. This prevents from doing anything useful with svcMapPhysicalMemory, as it uses this limit. I propose increasing it to maximum value - 0x1FE00000 to suit all (possible) homebrew.

This should be as simple as:

--- a/hbl.json
+++ b/hbl.json
@@ -11,6 +11,7 @@
     "is_64_bit": true,
     "address_space_type": 1,
     "is_retail": true,
+    "system_resource_size": "0x1FE00000",
     "filesystem_access": {
         "permissions": "0xFFFFFFFFFFFFFFFF"
     },
@fincs
Copy link
Contributor

fincs commented Nov 1, 2020

Support for new-style heap allocation is under consideration, however there are still problems we need to solve, such as the fact that it is not available on kernels older than 3.0.

@DCNick3
Copy link
Author

DCNick3 commented Nov 1, 2020

it is not available on kernels older than 3.0.

Wouldn't stable release of mesosphere lift this problem? I heard SciresM talk about it providing newer SVCs on low firmware versions

@fincs
Copy link
Contributor

fincs commented Nov 1, 2020

Yes it does. However we cannot have hbloader unconditionally use it regardless of system version, because it would break compatibility with the official kernel on old system versions. We've also not taken a decision yet on whether we'd require mesosphère to run on older system versions.

@DCNick3
Copy link
Author

DCNick3 commented Nov 1, 2020

Makes sense.

But, as far as I can understand SystemResourceSize NPDM field was simply reserved before 3.0.0. I guess whether adding it would be a breaking change depends on the way it was "reserved": either ignored (just fine) or forced to be zero (would be problematic).

@fincs
Copy link
Contributor

fincs commented Nov 1, 2020

I mean the fact that we'd have to remove usage of svcSetHeapSize in favor of dynamically resizing heap using PhysicalMemory SVCs. Currently it is using the old approach of reserving all the memory (leaving nothing left for potential PhysicalMemory users!).

@DCNick3
Copy link
Author

DCNick3 commented Nov 1, 2020

Oh, yeah, now I see the problem. Maybe something hybrid would work: use the novel API when available and svcSetHeapSize as a fallback. But this would probably be a maintenance pain..

@SciresM
Copy link
Contributor

SciresM commented Nov 1, 2020

The actual field isn't an issue, as the field in CreateProcessParameter is only set on 3.0.0+ (https://github.com/Atmosphere-NX/Atmosphere/blob/master/stratosphere/loader/source/ldr_process_creation.cpp#L340), and even then 1.0.0/2.0.0 kernels simply do not access the field inside svc::CreateProcessParameter (it was reserved/padding previously).

But yeah, it requires actual hbl design logic thought/changes, as finc has described.

@SciresM
Copy link
Contributor

SciresM commented Nov 1, 2020

(But also, yeah, if you want to use physical memory on < 3.0.0 this will require ams.loader changes. I guess I should think about that once mesosphere is stable).

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

3 participants