forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Loading modules from a user module (1.0/1.5)

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sat May 06, 2006 10:28 pm    Post subject: Loading modules from a user module (1.0/1.5) Reply with quote

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 ;)
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sun May 07, 2006 1:44 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
jockyw2001



Joined: 29 Sep 2005
Posts: 339

PostPosted: Sun May 07, 2006 2:20 am    Post subject: Re: Loading modules from a user module (1.0/1.5) Reply with quote

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
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sun May 07, 2006 4:13 am    Post subject: Reply with quote

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:
 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.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sun May 07, 2006 7:12 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sun May 07, 2006 8:05 pm    Post subject: Reply with quote

Okay I have added vshbridge to the sdk
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sun May 07, 2006 11:22 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
dot_blank



Joined: 28 Sep 2005
Posts: 498
Location: Brasil

PostPosted: Mon May 08, 2006 6:21 am    Post subject: Reply with quote

woopee! paf is good
everyone loves paf :)
_________________
10011011 00101010 11010111 10001001 10111010
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group