Usermode/libc - Makefile update, move stdin/... to .data for R_*_COPY to work
[tpg/acess2.git] / Usermode / Libraries / libc.so_src / stub.c
index 5f16c05..922943e 100644 (file)
@@ -28,7 +28,7 @@ extern void   _stdio_init(void);
 extern void    _call_atexit_handlers(void);\r
 \r
 // === GLOBALS ===\r
-extern char **_envp;\r
+extern char **environ;\r
 // --- CPU Features ---\r
 #if USE_CPUID\r
 tCPUID gCPU_Features;\r
@@ -45,20 +45,7 @@ tCPUID       gCPU_Features;
  */\r
 int SoMain(UNUSED(uintptr_t, BaseAddress), UNUSED(int, argc), UNUSED(char **, argv), char **envp)\r
 {\r
-       // Init for env.c\r
-       _envp = envp;\r
-\r
-       #if 0   \r
-       {\r
-                int    i = 0;\r
-               char    **tmp;\r
-               _SysDebug("envp = %p", envp);\r
-               for(tmp = envp; *tmp; tmp++,i++)\r
-               {\r
-                       _SysDebug("envp[%i] = '%s'", i, *tmp);\r
-               }\r
-       }\r
-       #endif\r
+       environ = envp;\r
 \r
        _stdio_init();  \r
        \r
@@ -76,12 +63,16 @@ int SoMain(UNUSED(uintptr_t, BaseAddress), UNUSED(int, argc), UNUSED(char **, ar
        // Set Error handler\r
        _SysSetFaultHandler(ErrorHandler);\r
        \r
-       return 1;\r
+       return 0;\r
 }\r
 \r
 int ErrorHandler(int Fault)\r
 {\r
         int    i;\r
+\r
+       extern void ldacess_DumpLoadedLibraries(void);  \r
+       ldacess_DumpLoadedLibraries();\r
+\r
        fprintf(stderr, "ErrorHandler: (Fault = %i)\n", Fault);\r
        fprintf(stderr, "Loaded Libraries:\n");\r
        for( i = 0; i < 64; i ++ )\r
@@ -94,11 +85,6 @@ int ErrorHandler(int Fault)
        return -1;\r
 }\r
 \r
-EXPORT int *libc_geterrno()\r
-{\r
-       return &_errno;\r
-}\r
-\r
 #if USE_CPUID\r
 /**\r
  * \brief Call the CPUID opcode\r

UCC git Repository :: git.ucc.asn.au