SecKernelLoadExec in PRX with devhook(FW2.xx)?

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

Moderators: cheriff, TyRaNiD

Post Reply
fishdrop
Posts: 16
Joined: Tue Oct 31, 2006 8:46 pm

SecKernelLoadExec in PRX with devhook(FW2.xx)?

Post by fishdrop »

I want to write prx code execute homebrew(fw1.50) in emulating mode(fw 2.xx).
So, my testing code following....

PSP_MODULE_INFO("ExecuteHB", 0x1000, 1, 1);
PSP_MAIN_THREAD_ATTR(0);
.........
ercd = sceKernelLoadExec(homebrewpath, NULL);
.........

But Error ocurs 0x80020149 which is SCE_KERNEL_ERROR_ILLEGAL_PERM_CALL

What is problem?
( I think this code in kernel mode. but behavior is not in --.)
Let me know please....
tnt
Posts: 9
Joined: Wed Oct 11, 2006 7:42 am

Post by tnt »

Do you have USE_KERNEL_LIBS in your prx makefile ?
I think it's needed to use the kernel version of sceKernelLoadExec ...
etenia
Posts: 6
Joined: Thu Sep 07, 2006 11:40 pm

Post by etenia »

Correct me if I'm wrong, but I thought homebrew voor 2xx (using Devhook) was only in user mode.

nice to hear that I'm not the only one who tries to load 1.50 homebrew in 2.71 firmware (devhook or not, but expecialy for native 2.71 TA-82 users). I'm stucked at the point to emulate the 1.50 firmware to execute the 1.50 homebrew :p
fishdrop
Posts: 16
Joined: Tue Oct 31, 2006 8:46 pm

Post by fishdrop »

tnt wrote:Do you have USE_KERNEL_LIBS in your prx makefile ?
I think it's needed to use the kernel version of sceKernelLoadExec ...
Of cource, I use USE_KERNEL_LIBS=1 in makefile.
fishdrop
Posts: 16
Joined: Tue Oct 31, 2006 8:46 pm

Post by fishdrop »

etenia wrote:Correct me if I'm wrong, but I thought homebrew voor 2xx (using Devhook) was only in user mode.

nice to hear that I'm not the only one who tries to load 1.50 homebrew in 2.71 firmware (devhook or not, but expecialy for native 2.71 TA-82 users). I'm stucked at the point to emulate the 1.50 firmware to execute the 1.50 homebrew :p
I think, no exists any restriction in prx because prx is a part of kernel.
If not, there is a cause or problem.

Let me know this.
etenia
Posts: 6
Joined: Thu Sep 07, 2006 11:40 pm

Post by etenia »

With HEN enabled, you can load other (kernel mode) modules trough a usermode module. HEN is also avaible for devhook

HEN is made by Dark_Alex and should be good to find. I thought Moonlight (from this forum) and Dark_Alex were the same :p

Edit: I made a Module Extender (a prx loader) for SE-A/B, but it only works on Devhook, because you can't load modules from a memorystick from SE (atm).
But what I want to say is that my Module Extender is in user mode. So it should be possible (but I will test my own code to make sure I'm not lying :p )

Code: Select all

PSP_MODULE_INFO("SE_ME", 0, 1, 1);
PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);

Code: Select all

SceUID mod = pspSdkLoadStartModule(line, PSP_MEMORY_PARTITION_KERNEL);

if &#40;mod < 0 &#41;
&#123;
	fprintf&#40;strout,"Loading module&#58; '%s' failed &#40;%x&#41;\n", line, mod&#41;;
	errorsCount++;
&#125;
where line is the module path.
I should mention that this a module wich loads other modules, so it's not in eboot format
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

You can't loadexec anything from kernel mode in 2.XX, the function sceKernelLoadExec in LoadExecForKernel doesn't exit anymore, and the function for LoadExecForUser gives the error illegal perm call when called from a vsh or kernel thread.

Of course in kernel mode you can patch everything. Looking at the asm code, you only have to patch a couple of conditionals to get rid of the illegal permanent call error.

Using user functions in kernel prx's is not a good idea in 2.XX. In fact, in 2.8X it is prohibited and a kernel prx with user imports doesn't load anymore...
fishdrop
Posts: 16
Joined: Tue Oct 31, 2006 8:46 pm

Post by fishdrop »

moonlight wrote:You can't loadexec anything from kernel mode in 2.XX, the function sceKernelLoadExec in LoadExecForKernel doesn't exit anymore, and the function for LoadExecForUser gives the error illegal perm call when called from a vsh or kernel thread.

Of course in kernel mode you can patch everything. Looking at the asm code, you only have to patch a couple of conditionals to get rid of the illegal permanent call error.

Using user functions in kernel prx's is not a good idea in 2.XX. In fact, in 2.8X it is prohibited and a kernel prx with user imports doesn't load anymore...
Thanks for your answer.
I already found it from your prx document home.
So, I try to another and have a question.
Why can't use pspsdk's libc in kernel mode?
(same reason above?)
Post Reply