| View previous topic :: View next topic |
| Author |
Message |
FreePlay
Joined: 04 Jan 2006 Posts: 71 Location: Schenectady, New York, USA
|
Posted: Thu Feb 22, 2007 8:52 am Post subject: Problems using kmode functions/kmem in a kmode module |
|
|
Kernel mode and I are not friends. At least, not right now.
I'm running 3.10 OE-A, and I've loaded a user-mode module in VSH mode that loads and starts a kmode module. This all runs smoothly - loads and starts up OK. At this point, several things happen.
0. The VSH runs just fine, as I hope it would.
1. File I/O seems to die completely. I use sceIoOpen and sceIoWrite to write to a logfile, but the writing never actually happens.
2. I cannot access kernel-mode functions or read/write kmem.
As an example of how I'm attempting to read kmem:
| Code: | | int res = sceIoWrite(fd,(void*)0x08000000,0x400000); |
fd, of course, is the SceUID of an output file.
When I call a function that uses this code, the PSP freezes. I'm not sure if it's related to sceIo, or to kmem access. But it's bugging me.
Anyone have any idea why it's doing this?
umode module --> load/start kmode module --> start main thread --> dump kmem --> freeze. |
|
| Back to top |
|
 |
FreePlay
Joined: 04 Jan 2006 Posts: 71 Location: Schenectady, New York, USA
|
Posted: Thu Feb 22, 2007 11:21 am Post subject: |
|
|
| I've narrowed the problem down to the actual kmem access. sceIo* works just fine, as it should. Is there something I have to do to 'unlock' kmem and actually use it? |
|
| Back to top |
|
 |
crazyc
Joined: 17 Jun 2005 Posts: 410
|
Posted: Thu Feb 22, 2007 11:50 am Post subject: |
|
|
| FreePlay wrote: | | I've narrowed the problem down to the actual kmem access. sceIo* works just fine, as it should. Is there something I have to do to 'unlock' kmem and actually use it? |
I've never tested it, but your code seem to confirm, that even kernel mode code can't access protected regions in KUSEG (0x0 - 0x7fffffff). You can unlock it by writing to mmio registers at 0xbc000000 but it would probably be easier to OR your pointers with 0x80000000. |
|
| Back to top |
|
 |
FreePlay
Joined: 04 Jan 2006 Posts: 71 Location: Schenectady, New York, USA
|
Posted: Thu Feb 22, 2007 12:02 pm Post subject: |
|
|
| So accessing it via 0x88000000 should work, even if 0x08000000 doesn't? I'll try that :/ |
|
| Back to top |
|
 |
FreePlay
Joined: 04 Jan 2006 Posts: 71 Location: Schenectady, New York, USA
|
Posted: Thu Feb 22, 2007 1:06 pm Post subject: |
|
|
Problem solved. This: | moonlight wrote: | Are you making your functions look like this?
| Code: |
int k1 = pspSdkSetK1(0);
code...;
pspSdkSetK1(k1);
return something;
|
|
gives me read/write access to kmem. This thread can be closed. |
|
| Back to top |
|
 |
|