| View previous topic :: View next topic |
| Author |
Message |
hotter

Joined: 07 Dec 2008 Posts: 53
|
Posted: Thu Mar 05, 2009 4:52 am Post subject: Export from kernel import on user |
|
|
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 |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Thu Mar 05, 2009 6:01 am Post subject: |
|
|
| 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 |
|
| Back to top |
|
 |
hotter

Joined: 07 Dec 2008 Posts: 53
|
Posted: Thu Mar 05, 2009 7:48 am Post subject: |
|
|
Thx very much, this sample helped me. _________________ Pragramming with:
Microsoft Visual C 2008 + pspsdk MINPSPW 0.8.10 |
|
| Back to top |
|
 |
Torch

Joined: 28 May 2008 Posts: 842
|
Posted: Thu Mar 05, 2009 1:04 pm Post subject: |
|
|
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. |
|
| Back to top |
|
 |
coolkehon
Joined: 20 Oct 2008 Posts: 355
|
Posted: Fri Mar 06, 2009 2:10 am Post subject: |
|
|
| hotter wrote: | | Thx very much, this sample helped me. |
finally i helped someone no problem |
|
| Back to top |
|
 |
|