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 

[solved]sceNandLock returns 800200D1

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



Joined: 22 Sep 2007
Posts: 156
Location: NY

PostPosted: Sat Feb 23, 2008 4:00 pm    Post subject: [solved]sceNandLock returns 800200D1 Reply with quote

Hi all,

I need your help since I am stuck on the following point :

I am under 3.90-2 M33 (no K1.5) I have prx in kernel mode.

sceNandGetPageSize, sceNandGetPagesPerBlock or sceNandGetTotalBlocks works fine but:

sceNandLock always returns 800200D1 (illegal permission ?)
and
sceNandIsBadBlock(i*nbPagePerBlock) always reports a bad block.

do you have any ideas?

thx
_________________
--pspZorba--
NO to K1.5 !


Last edited by pspZorba on Sun Feb 24, 2008 1:38 pm; edited 1 time in total
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sat Feb 23, 2008 11:05 pm    Post subject: Reply with quote

is the code in a function that has been exported to user? And if so, are you setting before the k1 to 0, pspSdkSetK1(0) ?
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Sat Feb 23, 2008 11:43 pm    Post subject: Reply with quote

sorry for the punctualization, but the point in k1 stuff is not to set k1 to 0, but read its value and restore it before return... function setting k1, returns previous k1 value....we are not using something like
Code:

k1=getK1();
.
.
.
setK1(k1);

because, according to a tyranid's post, getK1 is not working properly and there's no point in fixing it as long as setK1 returns previous k1 value.
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sun Feb 24, 2008 12:15 am    Post subject: Reply with quote

jean wrote:
sorry for the punctualization, but the point in k1 stuff is not to set k1 to 0, but read its value and restore it before return... function setting k1, returns previous k1 value....we are not using something like
Code:

k1=getK1();
.
.
.
setK1(k1);

because, according to a tyranid's post, getK1 is not working properly and there's no point in fixing it as long as setK1 returns previous k1 value.


The point is actually setting it to 0 (or at least shifting its value 16 bits to right like sce does), the firmware is full of checks of k1 value checks to know if the call was done by kernel mode or vsh/user.
Still, it is odd that such a function that is only available as kernel export would do those checks, maybe the error is by other reason.

About the sceNandIsBlock, are you sure it is returning 1 or just "non zero"? Maybe the function is a "troolean" one, returning 0, 1 and < 0 (error).
Back to top
View user's profile Send private message
pspZorba



Joined: 22 Sep 2007
Posts: 156
Location: NY

PostPosted: Sun Feb 24, 2008 12:48 am    Post subject: Reply with quote

Thanks Moonlight and Jean,

that was that, as soon as I put the K1 stuff around the sceNandLock and sceNandIsBlock, it works.

But I thought you had to set them only when you were accessing memory/variable comming from user space ?

About sceNandIsBlock, Moonlight you were right it is a "troolean function'. Before I set K1 things, it returned the same error as sceNandLock i.e. 800200D1

By the way there are blocks that are good and that I can't read (1 bad block, 2047 good blocks and only 1949 read => 98 not read), I saw an old post of yours on that matter, did you find why and how to read them?
_________________
--pspZorba--
NO to K1.5 !
Back to top
View user's profile Send private message
moonlight



Joined: 26 Oct 2005
Posts: 567

PostPosted: Sun Feb 24, 2008 6:28 am    Post subject: Reply with quote

Maybe it is because some blocks are not inited (and then, they don't have the correct ecc's), and sceNandReadBlock uses internally sceNandReadPage, which fails on ecc errors.

To dump the nand, sceNandReadPageRawAll (or sceNandReadAccess with the access param set to the same value ReadPageRawAll uses) should be the one used, which has no ecc check, I remember i posted a 2.XX+ example nand dumper in the release of 2.71 HEN.
Back to top
View user's profile Send private message
pspZorba



Joined: 22 Sep 2007
Posts: 156
Location: NY

PostPosted: Sun Feb 24, 2008 1:37 pm    Post subject: Reply with quote

thks moonlight you were write one more time.
I was able to read all blocks with sceNandReadPageRawAll.
_________________
--pspZorba--
NO to K1.5 !
Back to top
View user's profile Send private message
jean



Joined: 05 Jan 2008
Posts: 489

PostPosted: Mon Feb 25, 2008 10:00 pm    Post subject: Reply with quote

Quote:
The point is actually setting it to 0...

Ops....thanks, i missed this one...now i know something more than before. Maybe the "fix" tyranid was speaking about was to make getK1() function set k1 to 0 before returning the original value....
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