Usermode/ld-acess - Added exported function to dump loaded libraries to kernel log
authorJohn Hodge <[email protected]>
Sat, 7 Sep 2013 15:00:42 +0000 (23:00 +0800)
committerJohn Hodge <[email protected]>
Sat, 7 Sep 2013 15:00:42 +0000 (23:00 +0800)
Usermode/Libraries/ld-acess.so_src/Makefile
Usermode/Libraries/ld-acess.so_src/_stublib.c
Usermode/Libraries/ld-acess.so_src/export.c
Usermode/Libraries/ld-acess.so_src/loadlib.c

index 831d094..4dc881c 100644 (file)
@@ -11,7 +11,7 @@ EXTRABIN := libld-acess.so
 EXTRACLEAN = $(_OBJPREFIX)_stublib.o
 INCFILES := sys/sys.h
 
-CFLAGS   = -g -Wall -fno-builtin -fno-stack-protector -fPIC
+CFLAGS   = -g -Wall -fno-builtin -fno-stack-protector -fPIC -std=c99
 # -fno-leading-underscore
 CFLAGS  += $(CPPFLAGS)
 LDFLAGS  = -g -T arch/$(ARCHDIR).ld -Map map.txt --export-dynamic
index 69a392d..e01722b 100644 (file)
@@ -27,4 +27,5 @@ uint32_t __umodsi3(uint32_t Num, uint32_t Den){return 0;}
 
 void   *_crt0_exit_handler;
 void   abort(void){}
+void   ldacess_DumpLoadedLibraries(void){}
 
index 586078a..10c5c5c 100644 (file)
@@ -10,6 +10,7 @@ extern int32_t        __divsi3(int32_t Num, int32_t Den);
 extern int32_t __modsi3(int32_t Num, int32_t Den);
 extern uint32_t        __udivsi3(uint32_t Num, uint32_t Den);
 extern uint32_t        __umodsi3(uint32_t Num, uint32_t Den);
+extern void    ldacess_DumpLoadedLibraries(void);
 
 #define _STR(x)        #x
 #define STR(x) _STR(x)
@@ -30,6 +31,7 @@ const struct {
 }      caLocalExports[] = {
        EXP(gLoadedLibraries),
        EXP(_errno),
+       EXP(ldacess_DumpLoadedLibraries),
        
        #define __ASSEMBLER__
        #include "arch/syscalls.s.h"
index 5307301..88aafc3 100644 (file)
@@ -33,6 +33,18 @@ char *gsNextAvailString = gsLoadedStrings;
 //tLoadLib     *gpLoadedLibraries = NULL;
 
 // === CODE ===
+void ldacess_DumpLoadedLibraries(void)
+{
+       for( int i = 0; i < MAX_LOADED_LIBRARIES; i ++ )
+       {
+               if(gLoadedLibraries[i].Base == 0)       break;  // Last entry has Base set to NULL
+               _SysDebug("%p: %s",
+                       gLoadedLibraries[i].Base,
+                       gLoadedLibraries[i].Name
+                       );
+       }
+}
+
 const char *FindLibrary(char *DestBuf, const char *SoName, const char *ExtraSearchDir)
 {      
        // -- #1: Executable Specified

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