help about scereg and sceIoGetstat

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

Moderators: cheriff, TyRaNiD

Post Reply
tpu
Posts: 7
Joined: Mon Jan 28, 2008 2:54 pm

help about scereg and sceIoGetstat

Post by tpu »

1. I make a kernel prx as plugin.
2. In my prx, I patched the scereg module: find the string "flash1:", change it to "ms0:". scereg will use this string to open registry file.
3. In another user mode prx, I want open registry file on ms0 using sceRegOpenRegistry, but it return fail. I trace this call:
-> sceRegOpenRegistry(...)
->sceIoGetstat("ms0:/registry", &stat);
The sceIoGetstat return 0x80010016, Invalid argument?

4. If I do not patch scereg in step 2, no problem found.
If prx run as kernel mode in step 3, no problem found.

Why sceIoGetstat return 80010016?
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

The sceIoGetstat from 2.XX-3.71 fatms driver is a bit buggy, it shouldn't happen in 3.80.

Are you really calling sceIoGetstat from user mode, or from kernel mode?
tpu
Posts: 7
Joined: Mon Jan 28, 2008 2:54 pm

Post by tpu »

If I call sceIoGetstat directly from my own prx(user mode), it works fine.
But if sceIoGetstat called by sceRegOpenRegistry, it failed. The params was same: ("ms0:/registry", &stat)
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Kernel mode can't call the getstat of memory stick driver in 2.XX-3.71.
I think it is a bug, and that Sony didn't do it on purpose, as doesn't happen in the 3.80 new driver.

If you are in the vsh, you are lucky, because M33 vsh core patches the issue, if you are in other mode, then not.

Tell me the firmware you are using, and I will tell you the patch to apply.
tpu
Posts: 7
Joined: Mon Jan 28, 2008 2:54 pm

Post by tpu »

My firmware is 3.71M33-4.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

Call this code in a kernel prx:

Code: Select all

u32 *mod = (u32 *)sceKernelFindModuleByName("sceMSFAT_Driver"); 
u32 text_addr = *(mod +27);
_sw(0, text_addr+0x22D8);
sceKernelDcacheWritebackAll();
sceKernelIcacheClearAll();
But notice that that code would be 3.71 dependant.
Also i must warn you that your registry redirection may not work totally if registry.prx uses ioctl codes to flush the flash, that are not available in the memory stick driver (therefore, sceIoIoctl would return an error). In that case, the best would be to dummy the calls that registry does to sceIoIoctl to make them return 0.
tpu
Posts: 7
Joined: Mon Jan 28, 2008 2:54 pm

Post by tpu »

very thanks! I' will try first.
tpu
Posts: 7
Joined: Mon Jan 28, 2008 2:54 pm

Post by tpu »

It's works!

sceRegFlushCategory call the ioctl to flush file at end of function, but I can ignore it. My prx works at game mode, I think there is no game writting registry.
Post Reply