Export from kernel import on user

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

Moderators: cheriff, TyRaNiD

Post Reply
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Export from kernel import on user

Post by hotter »

I am trying to export function from kernel and import it on user mode prx, but make that work. It doesnt work when I am trying to export function from user and import it on kernel mode too. So is it possible to do that at all?
I guess it is users and kernels memory issues, because when I export from kernel and import on kernel everything work...
How could I solve this?
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

yeah it works i got it to work here is a working sample i use for my games i'm gonna post it soon somewhere but for now its on sendspace http://www.sendspace.com/file/dadsbe
User avatar
hotter
Posts: 53
Joined: Sun Dec 07, 2008 8:49 pm

Post by hotter »

Thx very much, this sample helped me.
Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10
User avatar
Torch
Posts: 825
Joined: Wed May 28, 2008 2:50 am

Post by Torch »

You can export from kernel to user (via a syscall) with an exports file like this:

PSP_EXPORT_START(kubridge, 0, 0x4001)
PSP_EXPORT_FUNC(some_kernel_to_user_function)
PSP_EXPORT_END

Then import it with 0x40090000 in stubs file:
STUB_START "kubridge",0x40090000,0x00010005
STUB_FUNC 0x12345678,some_kernel_to_user_function

For user to kernel, export the function normally from using the exports file. Then in your kernel module declare a prototype for the function. Then you have to find the address of the function at runtime using sctrlHENFindFunction (or using apihook if you don't want to import SystemCtrl from M33DSK) and assign it to the prototype. Before you call the function, you need to remove kernel-user memory protection using setDDRMemoryProtection or something.
coolkehon
Posts: 355
Joined: Mon Oct 20, 2008 5:44 am

Post by coolkehon »

hotter wrote:Thx very much, this sample helped me.
finally i helped someone no problem
Post Reply