[solved]sceNandLock returns 800200D1

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

Moderators: cheriff, TyRaNiD

Post Reply
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

[solved]sceNandLock returns 800200D1

Post by pspZorba »

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
Last edited by pspZorba on Sun Feb 24, 2008 1:38 pm, edited 1 time in total.
--pspZorba--
NO to K1.5 !
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

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) ?
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

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: Select all

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.
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

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: Select all

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).
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

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 !
moonlight
Posts: 567
Joined: Wed Oct 26, 2005 7:46 pm

Post by moonlight »

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.
pspZorba
Posts: 156
Joined: Sat Sep 22, 2007 11:45 am
Location: NY

Post by pspZorba »

thks moonlight you were write one more time.
I was able to read all blocks with sceNandReadPageRawAll.
--pspZorba--
NO to K1.5 !
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

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....
Post Reply