8002013C by loading kernel prx in user mode app

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

Moderators: cheriff, TyRaNiD

Post Reply
DickyDick
Posts: 29
Joined: Sat Aug 21, 2004 2:28 am

8002013C by loading kernel prx in user mode app

Post by DickyDick »

Hi there,

I try to load mymodule.prx from the SDK samples (testprx) in an user mode app (a PRX inside PBP which is running from dir /PSP/GAME on 3.52 M33-4) using the following code:

SceUID modid = sceKernelLoadModule("ms0:/mymodule.prx",0,0);

if (modid < 0) {
pspDebugScreenPrintf ("Result from loading %08X\n",modid);
}
else {
int ret = sceKernelStartModule(modid, 0, NULL, &fd, NULL);

if (ret < 0) {
pspDebugScreenPrintf ("Result from starting %08X\n", ret);
}
}


it returns:
Result from starting 8002013C

How can I fix this ?
mymodule.prx is extremely simple (see samples in PSPSDK)
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

0x8002013C means library not found which means some library you are trying to link into your kernel prx is not there or available. Really I wonder why people touch kernel mode when they dont klnow anything about it :)
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

you say

Code: Select all

a PRX inside PBP which is running from dir /PSP/GAME on 3.52 M33-4
but then you contradict with
SceUID modid = sceKernelLoadModule("ms0:/mymodule.prx",0,0) ;
10011011 00101010 11010111 10001001 10111010
DickyDick
Posts: 29
Joined: Sat Aug 21, 2004 2:28 am

Post by DickyDick »

TyRaNiD wrote:0x8002013C means library not found which means some library you are trying to link into your kernel prx is not there or available. Really I wonder why people touch kernel mode when they dont klnow anything about it :)
yeah yeah.. And the state of the documentation is in such a good quality I *should* know anything about it. I don't have all the time and perhaps the intellect to reverse engineer the PSP like u do.... The fact remains that the most basic and simple prx module with only links with -lpspuser -lpspkernel -lpsplibc can't run in that environment. AND IT DID UNDER 3.10 oe.. And nobody of you can give me a proper answer about that. Of course I googled the damn error code, and I know what it means. But I hoped that you cracks did know something I didn't!

AND I NEED an USER mode application for WPA network and kernel for ME stuff for realtime video decoding.. Please don't lecture me.

Dickydick. Pimpware.org
DickyDick
Posts: 29
Joined: Sat Aug 21, 2004 2:28 am

Post by DickyDick »

dot_blank wrote:you say

Code: Select all

a PRX inside PBP which is running from dir /PSP/GAME on 3.52 M33-4
but then you contradict with
SceUID modid = sceKernelLoadModule("ms0:/mymodule.prx",0,0) ;
The PBP runs and connects through WPA in user mode (1.50 doesn't know WPA) .. I need that..
Also I need a kernel module for ME stuff... So that's why I need kernel module. I don't see any contradiction in that.
And these EXACT statements DID run under 3.10 OE
jas0nuk
Posts: 137
Joined: Thu Apr 27, 2006 8:00 am

Post by jas0nuk »

Try pspSdkLoadStartModule:

Code: Select all

SceUID mod = pspSdkLoadStartModule&#40;"ms0&#58;/blah.prx", PSP_MEMORY_PARTITION_KERNEL&#41;;
if &#40;mod < 0&#41; &#123;
        	printf&#40;"Error 0x%08X loading/starting blah.prx.\n", mod&#41;;
&#125;
Works fine for me under the 3.52 kernel.
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

DickyDick wrote:
dot_blank wrote:you say

Code: Select all

a PRX inside PBP which is running from dir /PSP/GAME on 3.52 M33-4
but then you contradict with
SceUID modid = sceKernelLoadModule("ms0:/mymodule.prx",0,0) ;
The PBP runs and connects through WPA in user mode (1.50 doesn't know WPA) .. I need that..
Also I need a kernel module for ME stuff... So that's why I need kernel module. I don't see any contradiction in that.
And these EXACT statements DID run under 3.10 OE
i guess you TOTALLY missed what i was pointing out :) ...never did i say anything about
kernel mode and user mode / threads / access modes

point is that you say you put this module with your PSP/GAMExx/APP/xxx
but then you call to root of fatms0:/ for this same module ...so it would
not be able to find and link

also we are not "cracks" here :) ....also you dont NEED kernel mode
you just NEED to patch module init :)
10011011 00101010 11010111 10001001 10111010
DickyDick
Posts: 29
Joined: Sat Aug 21, 2004 2:28 am

Post by DickyDick »

also we are not "cracks" here :) ....also you dont NEED kernel mode
you just NEED to patch module init :)
That's what I learned today:

1. some kind of dependancy on linking modules:
- they need to be in the same (GAME) folder
2. you don't need kernel mode for using the 'me'

Thanks, these are the answers I look for, thank you for your time (and patience ;-))
DickyDick
Posts: 29
Joined: Sat Aug 21, 2004 2:28 am

Post by DickyDick »

jas0nuk wrote:Try pspSdkLoadStartModule:

Code: Select all

SceUID mod = pspSdkLoadStartModule&#40;"ms0&#58;/blah.prx", PSP_MEMORY_PARTITION_KERNEL&#41;;
if &#40;mod < 0&#41; &#123;
        	printf&#40;"Error 0x%08X loading/starting blah.prx.\n", mod&#41;;
&#125;
Works fine for me under the 3.52 kernel.

And you started the loading app in USER mode ? I still get the 8002013c. Also I run from GAME and not from GAME150 or other.

I used the prx module in the sdk example. Perhaps there is something wrong with that beast.
jas0nuk
Posts: 137
Joined: Thu Apr 27, 2006 8:00 am

Post by jas0nuk »

Yes, the app which calls pspSdkLoadStartModule is fully usermode, perhaps the 3.xx kernel doesn't like the SDK PRX sample? o_O
User avatar
dot_blank
Posts: 498
Joined: Wed Sep 28, 2005 8:47 am
Location: Brasil

Post by dot_blank »

perhaps you shouldnt be touching the kernel memory partitions

SceUID mod = pspSdkLoadStartModule("ms0:/blah.prx", PSP_MEMORY_PARTITION_KERNEL);
10011011 00101010 11010111 10001001 10111010
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

jas0nuk wrote:Yes, the app which calls pspSdkLoadStartModule is fully usermode, perhaps the 3.xx kernel doesn't like the SDK PRX sample? o_O
I suggest folks work from the nanddumper example in the 3.xx HEN archive. That works perfectly in 3.xx on the phat and slim. The main app is a user mode program that calls an external prx with the kernel stuff in it. The kernel mode prx is simple, just reading the nand, but it gives a nice skeleton for how 3.xx apps should be done.
DickyDick
Posts: 29
Joined: Sat Aug 21, 2004 2:28 am

Post by DickyDick »

Now.. I got it to work.. With the PSP sdk example!

Solution: Had to strip all the ctr0 and startup stuff. (and provide module_start myself) now only -lpspkernel has to link. And the kernel PRX just loads and runs fine!

Code: Select all

psp-gcc -I/usr/local/pspdev/psp/sdk/include/libc -I. -I/usr/local/pspdev/psp/sdk/include -O2 -G0 -Wall -D_PSP_FW_VERSION=150  -L. -L/usr/local/pspdev/psp/sdk/lib -specs=/usr/local/pspdev/psp/sdk/lib/prxspecs -Wl,-q,-T/usr/local/pspdev/psp/sdk/lib/linkfile.prx -mno-crt0 -nostartfiles   main.o exports.o -lpspkernel  -o mymodule.elf
TyRaNiD
Posts: 907
Joined: Sun Jan 18, 2004 12:23 am

Post by TyRaNiD »

Seeing as people seem to have so much trouble with making a kernel prx I bothered to put my template into the sdk under samples/templates/kprx_template. Just add code to main_thread and you are in business.
KickinAezz
Posts: 328
Joined: Sun Jun 03, 2007 10:05 pm

Post by KickinAezz »

TyRaNiD wrote:Seeing as people seem to have so much trouble with making a kernel prx I bothered to put my template into the sdk under samples/templates/kprx_template. Just add code to main_thread and you are in business.
I use the exact samefile EXCEPT... It uses build.mak instead of build_prx.mak... What would be the difference?
kururin
Posts: 36
Joined: Wed Jul 05, 2006 7:19 am

Post by kururin »

Remember to always use only kernel libraries in the kernel prx. Use user libraries in the kernel prx is one of the main reasons you got that 8002013C error.

Anyways in 3.71 you will probably have more problems, since Sony has changed some kernel nids (they can't change the user ones that game use), like the ones of ctrl.prx, syscon, gpio, power, and some others.

Really in 3.XX you should restrict the kernel code to the minimum, and only use it for the things that really require it.

One of the main cases why a 1.50 application used kernel mode, was to load modules from flash and patch the device check and plain module check, in 3.XX, that is not necesary, since you don't need to do any patch, and you could usually call kuKernelLoadModule from cfw sdk to load a module with the same privileges than a kernel module would do it. You can also use sceKernelLoadModule, but that one fails with some of the modules of the flash.

The problem of net applications in 1.5X (that had to be kernel mode to load the flash modules), doesn't apply here either.
Post Reply