[Example Plugin] Updated the example plugin

- It's now linking with libc/libutils/libdynamiclibs
- moved the main.c into the a "src" folder

[Loader]- Added DCFlushRange and DCInvalidateRange
- Improved logging.

Finally we can load the plugin from the sdcard and call it's function!
This commit is contained in:
Maschell
2018-02-09 21:31:05 +01:00
parent 4ce98a64f1
commit 10c5eccd93
6 changed files with 68 additions and 47 deletions

View File

@@ -74,12 +74,17 @@ void loadAndProcessElf(const char * elfPath){
if(Module_CheckFile(elfPath)){
Module_Load(elfPath);
DEBUG_FUNCTION_LINE("Found %d modules!\n",module_list_count);
//printInfos();
printInfos();
unsigned char * space = (unsigned char*)0x00910000;
Module_ListLink(&space);
printInfos();
DCFlushRange ((void*)0x00850000,0x00910000-0x00850000);
DCInvalidateRange((void*)0x00850000,0x00910000-0x00850000);
if(module_relocations_count == 0){
DEBUG_FUNCTION_LINE("We need no relocations, we can call the functions!!\n");
DEBUG_FUNCTION_LINE("We need no more relocations, we can call the functions!!\n");
DEBUG_FUNCTION_LINE("Calling %d functions!\n",module_entries_count);
for (unsigned int i = 0; i < module_entries_count; i++) {
DEBUG_FUNCTION_LINE("--- Function %d ---\n",i);
@@ -87,9 +92,11 @@ void loadAndProcessElf(const char * elfPath){
module_entries[i].type == WUPS_LOADER_ENTRY_FUNCTION_MANDATORY){
DEBUG_FUNCTION_LINE("Let's call the function: %s \n",module_entries[i].data._function.name);
int ret = ( (int (*)(void))((unsigned int*)module_entries[i].data._function.target) )();
DEBUG_FUNCTION_LINE("result: %d \n",ret);
DEBUG_FUNCTION_LINE("result: %08X \n",ret);
}
}
}else{
DEBUG_FUNCTION_LINE("There are still symbols that need to be resolved. Can't call the functions\n");
}
}