Within the nand-flash there exists at least three distinct areas:
- * the ipl
* the two fat filesystems flash0 and flash1
* the idstorage area
The keys are stored in an index which consists of two nand pages of 512 bytes. The index is identified by byte 6 of the spare area being 0x73. Byte 7 might be the id-storage version number. Byte 8 must be 1 (or possibly 0) and might indicate whether the storage is formatted or not, and a value greater than 1 in byte 9 indicates that the id-storage is read-only.
In my PSP with firmware 1.5, the id-storage index is identified by:
Code: Select all
0x56 0xa6 0x65 0x00 0xff 0xff 0x73 0x01 0x01 0x01 0xff 0xff 0x86 0xf1 0xff 0xff
The keys are stored in the corresponding user areas of the pages. Keys are 16-bit integers. The location of the data associated with a key is identified by the key's position in the index. For instance, a key appearing at position 97 (byte 194) in the index will find its associated data at location: 0xc0000 + (97 * 512) = 0xcc200.
Various subsystems in the PSP make use of the id-storage including usb, wlan, umd, etc.
The firmware provides a driver in idstorage.prx to facilitate manipulations.
Some common functions:
Code: Select all
/* sceIdStorageLookup() - Retrieves the value associated with a key
* args: key = id-storage key
* offset = offset within the 512-byte leaf
* buf = buffer with enough storage
* len = amount of data to retrieve (offset + len must be <= 512 bytes)
*/
int sceIdStorageLookup(u16 key, u32 offset, void *buf, u32 len);
/* sceIdStorageReadLeaf() - Retrieves the whole 512-byte container for the key
* args: key = id-storage key
* buf = buffer with at last 512-bytes of storage
*/
int sceIdStorageReadLeaf(u16 key, void *buf);