[Solved] Module Manager busy?

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
Coldbird
Posts: 97
Joined: Thu Feb 08, 2007 7:22 am

[Solved] Module Manager busy?

Post by Coldbird »

Code: Select all

  // User Module Loading Options
  SceKernelLMOption option;
  SceUID mpid = PSP_MEMORY_PARTITION_USER;
  memset(&option, 0, sizeof(option));
  option.size = sizeof(option);
  option.mpidtext = mpid;
  option.mpiddata = mpid;
  option.position = 0;
  option.access = 1;
  
  // Load User Module
  SceUID usermodule = kuKernelLoadModule(USER_MODULE_PATH, 0, &option);
  
  // Start User Module
  int startstatus = 0;
  char * test = "Coldbird loaded a Usermodule!";
  result = sceKernelStartModule(usermodule, strlen(test), (void*)test, &startstatus, NULL);
Both usermodule & result get the value 0x80020143 which equals the constant of "Module Manager Busy".

I know that the errors' meaning is quite self-explaining but how am I ment to counteract this?

Hook into the module-loading dialog using the M33 SDK and wait for all modules to be loaded?

I'm hoping someone of you has a idea.

Greetings, Coldbird.
Last edited by Coldbird on Thu Apr 02, 2009 1:22 am, edited 1 time in total.
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
NoEffex
Posts: 106
Joined: Thu Nov 27, 2008 6:48 am

Post by NoEffex »

Could try

Code: Select all

while(!sceKernelFindModuleByName("sceKernelLibrary")) sceKernelDelayThread(100000);
Programming with:
Geany + Latest PSPSDK from svn
User avatar
Coldbird
Posts: 97
Joined: Thu Feb 08, 2007 7:22 am

Post by Coldbird »

I don't quite see what this has to do with the Kernel Library...
Mind giving a explanation?
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

There's appears to be nothing wrong with that code. Where are you calling it from? And why do you need kuKernelLoadModule?
User avatar
Coldbird
Posts: 97
Joined: Thu Feb 08, 2007 7:22 am

Post by Coldbird »

Because other Module Loading Functions fail to execute.
I found the hint to use this ku function in a old topic of yours aswell. It doesn't crash, thus I think it's the right function to use, but the just mentioned Module Manager is busy stuff pops up.

First attempt was to call it in module_start but I figured that this might be the problem because module_start still belongs to the Module Manager Initialization...

So I moved it to the Main Thread by moving it into main. But still no different.

I even coded a few debug routines to output me what's happening...

Here goes the tracelog...

Code: Select all

Entering int main(int argc, char * argv[])
Entering int initPlayNet(void)
Leaving int initPlayNet(void)
Entering int hookModules(void)
Entering SceUID loadModule(const char * path, SceUID mpid, uint32 maxattempts)
Leaving int SceUID loadModule(const char * path, SceUID mpid, uint32 maxattempts)
Leaving int hookModules(void)
And here the debuglog...

Code: Select all

ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #1
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #2
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #3
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #4
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #5
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #6
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #7
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #8
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #9
ms0:/seplugins/adhocwrapper/usermodule.prx Load Attempt #10
ms0:/seplugins/adhocwrapper/usermodule.prx Load Failed - 80020143
ms0:/seplugins/adhocwrapper/usermodule.prx Failed to load
Don't wonder about main not leaving properly... I did a while(1) loop in there with sceKernelDelayThread to keep the thread alive.

I did a few wrapper functions for everything, to have a easier time calling complex stuff without having to triple check every error possibility.

There are two wrappers, namely loadModule and startModule... startModule only get's called when loadModule did it's job properly... judging from the debuglog we can see it doesn't.

From the tracelog you can figure out the calling conventions too, not that they are important but the more info the better I suppose.
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

ku* functions are nothing but syscalls to the kernel mode equivalent of the sce* function. Its the same as calling sceKernelLoadModule from a kernel PRX. AFAIK kernel mode is only needed to load special modules like vshmain.prx.

You've screwed up something elsewhere which is causing this. You might have some plugins enabled thats causing this or something.
User avatar
Coldbird
Posts: 97
Joined: Thu Feb 08, 2007 7:22 am

Post by Coldbird »

Can't be the plugins, the only one in game.txt is my kernelmodule.prx - which attempts to load usermodule.prx.

Edit: I exchanged the ku one for the normal sceKernelLoadModuleMS and now I get the error code 0x8002013A which equals the constant SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED.

But how can that thing not be linked?

Edit #2: I think I know what's the problem. The library that contains the sceKernelLoadModuleMS function isn't loaded yet...

But without the function being residing in memory I can't load other libraries, can I? I mean... the loader functions are located in that library.

I'm probably misinterpreting the error, if so please correct me.
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
NoEffex
Posts: 106
Joined: Thu Nov 27, 2008 6:48 am

Post by NoEffex »

Coldbird wrote:Can't be the plugins, the only one in game.txt is my kernelmodule.prx - which attempts to load usermodule.prx.

Edit: I exchanged the ku one for the normal sceKernelLoadModuleMS and now I get the error code 0x8002013A which equals the constant SCE_KERNEL_ERROR_LIBRARY_NOT_YET_LINKED.

But how can that thing not be linked?

Edit #2: I think I know what's the problem. The library that contains the sceKernelLoadModuleMS function isn't loaded yet...

But without the function being residing in memory I can't load other libraries, can I? I mean... the loader functions are located in that library.

I'm probably misinterpreting the error, if so please correct me.
The little thing I posted waits until all the kernel modules are loaded, which should solve the problem of it not being loaded.
Programming with:
Geany + Latest PSPSDK from svn
User avatar
Coldbird
Posts: 97
Joined: Thu Feb 08, 2007 7:22 am

Post by Coldbird »

I figured as much. The problem is that never happens. With your code in there it ends in a endless loop.
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
NoEffex
Posts: 106
Joined: Thu Nov 27, 2008 6:48 am

Post by NoEffex »

Coldbird wrote:I figured as much. The problem is that never happens. With your code in there it ends in a endless loop.
Have you tried it? It's always worked fine for me. In english: "Lets check if sceKernelLibrary is loaded, you know, the kernel. If it is, lets go ahead and skip this delay here, else we'll delay and start from square one".
Programming with:
Geany + Latest PSPSDK from svn
User avatar
Coldbird
Posts: 97
Joined: Thu Feb 08, 2007 7:22 am

Post by Coldbird »

I know what it means. My C / C++ knowledge ain't that basic.
The problem is just what I told you. I've placed debug code around the command... it's stuck there.

I can't understand that myself... cause I know that the kernel library for usermode modules is loaded as a standard module from firmware config on flash...

Nor can I see anything wrong with the snippet you provided.

I'm far more trying to understand why this is the case.

Edit: SOLVED! All I had to do was use the sceKernelLoadModule & sceKernelStartModule in their own thread so they can't block the caller.

The sceKernelDelayThread while waiting for Kernel Module was needed aswell.

In combination. It works very well. Thanks everyone!
Been gone for some time. Now I'm back. Someone mind getting me up-2-date?
Post Reply