Loading modules from a user module (1.0/1.5)

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

Moderators: cheriff, TyRaNiD

Post Reply
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Loading modules from a user module (1.0/1.5)

Post by TyRaNiD »

Unfortunately this is not a new technique to load modules in a user module without ever touching kernel mode, however it is a slightly better one than previous stuff :P

As many will know loading modules up on the 1.0 and 1.5 version PSPs generally require kernel mode somewhere. However it is also the case that trying to link in a user module (which you just loaded) into a kernel module will fail as the kernel doesn't want to link those two apps together. There has been various ways of resolving this issue for things like the net libs and atrac3 by manually scanning and resolving the functions at run time which is abit of a pain, or using a bootstrap which you tend to have to write to load up all your modules before your own user mode app starts in order that everything is working.

In pspsdk I have added a new patch (pspSdkInstallKernelLoadModulePatch) which once installed in kernel mode will allow a user app to load what ever modules it likes in what ever order it likes (potentially saving ram etc.) This superceeds the nodevice check patch which worked for encrypted kernel prx from flash but would crash the kernel when loading the all important user modules thereby making it fairly useless.

I have included the patch in psplink's bootstrap as well as psppacker so if you are developing an application which needs to load modules then you can first develop it under psplink loading modules when ever you feel like and for release you can run it through psppacker and the resultant binary should then work as expected on any 1.0 and 1.5 psp.

Of course you lot can just ignore me ;)
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Good job, this is a nicer way of solving that issue.

Btw, i wanted to ask you if more vsh functions will be added to the sdk. At the moment only the sceChnnlsv is in the sdk, it would be interesting to have more modules, like the sceVshBridge and others :p
jockyw2001
Posts: 339
Joined: Thu Sep 29, 2005 4:19 pm

Re: Loading modules from a user module (1.0/1.5)

Post by jockyw2001 »

TyRaNiD wrote:I have included the patch in psplink's bootstrap as well as psppacker so if you are developing an application which needs to load modules then you can first develop it under psplink loading modules when ever you feel like and for release you can run it through psppacker and the resultant binary should then work as expected on any 1.0 and 1.5 psp.
Does that mean that in my app I can change the PSP_MODULE_INFO argument from 0x1000 to 0x0 and then run the app in psplink if in psplink.ini I modload all the modules used by my app? That is provided my app does not include vfpu and me code.

EDIT:
No I seem to misunderstand something. I tried my assumption with the example in /usr/local/pspdev/psp/sdk/samples/net/simple
It returns: Error, command did not complete 0x800201A8
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

jockyw2001 well net/simple isn't the best place to start. That calls kernel functions so if you are a user mode app it will crash what ever. Adding the module using modload defeats the object, you can do that but this is not what the patch is designed to allow. The patch is to allow you to load modules directly from your user app.

If you add say

Code: Select all

 SceUID modID;

    modID = pspSdkLoadStartModule("flash0:/kd/ifhandle.prx", PSP_MEMORY_PARTITION_KERNEL);
    modID = pspSdkLoadStartModule("flash0:/kd/pspnet.prx", PSP_MEMORY_PARTITION_USER);
    modID = pspSdkLoadStartModule("flash0:/kd/pspnet_inet.prx", PSP_MEMORY_PARTITION_USER);
    modID = pspSdkLoadStartModule("flash0:/kd/pspnet_apctl.prx", PSP_MEMORY_PARTITION_USER);
    modID = pspSdkLoadStartModule("flash0:/kd/pspnet_resolver.prx", PSP_MEMORY_PARTITION_USER);
to the main function of net/simple_prx then you will see it works ;)

moonlight, if you want more stubs adding to pspsdk it isn't an issue just one of effort :) I personally just haven't been bothered to do so.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

TyRaNiD wrote: moonlight, if you want more stubs adding to pspsdk it isn't an issue just one of effort :) I personally just haven't been bothered to do so.
At least the stubs of sceVshBridge would help me to test some things easier.
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Okay I have added vshbridge to the sdk
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

TyRaNiD wrote:Okay I have added vshbridge to the sdk
thanks :) i have seen that you have also added the biggest module of the firmware, the paf, which is also interesting.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

woopee! paf is good
everyone loves paf :)
10011011 00101010 11010111 10001001 10111010
Post Reply