Well I just added the functions to the SDK to allow access to these areas, there are in sceSuspendForUser for usermode calls and scePower_driver for kernel mode.
For user mode they are defined in pspsuspend.h as:
Code: Select all
sceSuspendForUser_3E0271D3(int unk, void **ptr, int *size);
int sceSuspendForUser_A14F40B2(int unk, void **ptr, int *size);
int sceSuspendForUser_A569E425(void);
For kernel mode they are:
Code: Select all
scePower_driver_23C31FFE
scePower_driver_FA97A599
scePower_driver_B3EDD801
Now as these are in a suspend library it is a fair chance that the kernel uses them for something, I haven't tested it but it might be used when suspending or sommit therefore you might not be able to use it as a general purpose area :( Still worth a try and see how far you get ;P
Now for the techy minded this is an explanation of how they work :) The core function is sceKernelSetDdrMemoryProtection(void *addr, int size, int prot). By calling this you can set the memory protection bits on certain memory blocks (well only in the first 8Mb of DDR). Addr is obvious, size is a value up to 2 megs in 256KByte blocks, prot is a 4 bit mask which determines the protection.
The prot mask is thus:
Bit 3 - Kernel Write Enable
Bit 2 - Kernel Read Enable
Bit 1 - User Write Enable
Bit 0 - User Read Enable
The first four megs are all set to 0xC prot mask which means kernel only read/write, this is interesting cause you can therefore "unprotect" the kernel only address space and access it in user mode :)
e.g.
Code: Select all
sceKernelSetDdrMemoryProtection((void*) 0x08000000, 2*1024*1024, 0xF);
Now for the real techy minded (i.e. groepaz) this is what that function is doing.
The memory protection registers are 8 32bit words stating at 0xbc000000. Each 32bit is split into 8 4bit protection masks starting LSB first, i.e. bits 0 to 3 are the first 256KBytes of that chunk, bits 4 to 7 are the next etc. And as each register can address 8 256KByte blocks then the address space is split into 2Mbyte chunks.
Do for example 0xbc000000 sets protection on 0x08000000 -> 0x081FFFFFF, 0xbc000004 sets on 0x08200000 -> 0x083FFFFF and so on.
There doesn't seem to be any registers for any addresses greater than this so Sony only protected the first 8Megs.