hos: change initialization API
This was needed to make stratosphere buildable with debugging on. os:: assertions rely on GetCurrentThread() working, and this requires the global os resource manager to be constructed. However, __appInit executes before global constructors. We now require that hos::InitializeForStratosphere() be called before anything else is done. This initializes the os resource manager, sets the hos version for libnx, and may do more things in the future. TODO: Consider replacing __appInit/__appExit with ams:: namespace functions in general, and wrap them so that we guarantee hos::InitializeForStratosphere is called first, and generally ensure a consistent stratosphere environment.
This commit is contained in:
@@ -74,7 +74,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
@@ -86,7 +86,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
/* Initialize services we need (TODO: NCM) */
|
||||
sm::DoWithSession([&]() {
|
||||
|
||||
@@ -66,7 +66,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
/* Initialize services we need. */
|
||||
sm::DoWithSession([&]() {
|
||||
|
||||
@@ -68,7 +68,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsInitialize());
|
||||
|
||||
@@ -60,7 +60,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(pmdmntInitialize());
|
||||
|
||||
@@ -66,7 +66,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
|
||||
@@ -72,7 +72,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(setInitialize());
|
||||
|
||||
@@ -68,7 +68,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
/* Initialize services we need. */
|
||||
sm::DoWithSession([&]() {
|
||||
|
||||
@@ -91,7 +91,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
fs::SetAllocator(Allocate, Deallocate);
|
||||
|
||||
|
||||
@@ -117,7 +117,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
fs::SetAllocator(pgl::Allocate, pgl::Deallocate);
|
||||
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(fsprInitialize());
|
||||
|
||||
@@ -58,7 +58,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
sm::DoWithSession([&]() {
|
||||
R_ABORT_UNLESS(setsysInitialize());
|
||||
|
||||
@@ -70,7 +70,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
/* We must do no service setup here, because we are sm. */
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ void __libnx_initheap(void) {
|
||||
}
|
||||
|
||||
void __appInit(void) {
|
||||
hos::SetVersionForLibnx();
|
||||
hos::InitializeForStratosphere();
|
||||
|
||||
/* SPL doesn't really access any services... */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user