forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

help about scereg and sceIoGetstat

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
tpu



Joined: 28 Jan 2008
Posts: 7

PostPosted: Mon Jan 28, 2008 3:13 pm    Post subject: help about scereg and sceIoGetstat Reply with quote

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?
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Jan 28, 2008 7:15 pm    Post subject: Reply with quote

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?
Back to top
View user's profile Send private message
tpu



Joined: 28 Jan 2008
Posts: 7

PostPosted: Mon Jan 28, 2008 8:13 pm    Post subject: Reply with quote

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)
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Jan 28, 2008 8:37 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
tpu



Joined: 28 Jan 2008
Posts: 7

PostPosted: Mon Jan 28, 2008 11:26 pm    Post subject: Reply with quote

My firmware is 3.71M33-4.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Mon Jan 28, 2008 11:59 pm    Post subject: Reply with quote

Call this code in a kernel prx:

Code:
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.
Back to top
View user's profile Send private message
tpu



Joined: 28 Jan 2008
Posts: 7

PostPosted: Tue Jan 29, 2008 12:37 am    Post subject: Reply with quote

very thanks! I' will try first.
Back to top
View user's profile Send private message
tpu



Joined: 28 Jan 2008
Posts: 7

PostPosted: Tue Jan 29, 2008 1:47 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group