From ccdfd315c37cffa2b83c5114b0f925bf7a15cd59 Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Mon, 15 Jul 2024 23:17:57 +0200 Subject: [PATCH 1/2] Call _InitSys() before newlib initialization --- ee/startup/src/crt0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ee/startup/src/crt0.c b/ee/startup/src/crt0.c index f0caa5c5603..bf894c3a1a7 100644 --- a/ee/startup/src/crt0.c +++ b/ee/startup/src/crt0.c @@ -97,6 +97,9 @@ static void _main() // NOTE: this call can restart the application if (_ps2sdk_memory_init) _ps2sdk_memory_init(); + + // Initialize the kernel (Apply necessary patches). + _InitSys(); // Use arguments sent through start if sent (by ps2link for instance) pa = &args; @@ -113,9 +116,6 @@ static void _main() if (_init) _init(); - // Initialize the kernel (Apply necessary patches). - _InitSys(); - // Enable interruts EI(); From 015b0b288e06e68836a7ea88caa7141911bc62fa Mon Sep 17 00:00:00 2001 From: Francisco Javier Trujillo Mata Date: Mon, 15 Jul 2024 23:42:28 +0200 Subject: [PATCH 2/2] Enable Interrupts before the C++ inits --- ee/startup/src/crt0.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ee/startup/src/crt0.c b/ee/startup/src/crt0.c index bf894c3a1a7..67dc9b15b1b 100644 --- a/ee/startup/src/crt0.c +++ b/ee/startup/src/crt0.c @@ -112,13 +112,13 @@ static void _main() // initialize libcglue _libcglue_init(); + // Enable interruts + EI(); + // call global constructors (weak) if (_init) _init(); - // Enable interruts - EI(); - // call main retval = main(pa->argc, pa->argv);