Kernel mode malloc library
Kernel mode malloc library
Here is a bit modified library to use normally the malloc function in kernel mode!
The library was writed by Hellcat, I've only compiled and a bit modified it!
Maybe anyone can add this or another library to use the malloc functions in kernel mode to svn...
Can be useful!
http://www.megaupload.com/?d=3EEF4F71
The library was writed by Hellcat, I've only compiled and a bit modified it!
Maybe anyone can add this or another library to use the malloc functions in kernel mode to svn...
Can be useful!
http://www.megaupload.com/?d=3EEF4F71
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
Great stuff
But MallocList[32] is a table limitted to 32 entry and in the malloc code
there is no code present to handle if more than 32 malloc has been asked
so memory corruption ;)
Another question : what is the purpose of the flag PSP_SMEM_Low ?
reserve memory compatible FAT & SLIM aka < 32 Méga ?
But MallocList[32] is a table limitted to 32 entry and in the malloc code
there is no code present to handle if more than 32 malloc has been asked
so memory corruption ;)
Another question : what is the purpose of the flag PSP_SMEM_Low ?
reserve memory compatible FAT & SLIM aka < 32 Méga ?
I've rewrited it using a dinamical list, I've tryed it and it works, but can anyone try this? I'm not really sure that it works perfect! Is not finished, I've to add some things...
http://www.megaupload.com/?d=4UYQ9TB6
Anyway, how to printf with kernel libc??
There's a way to do it? I won't use formatting...
http://www.megaupload.com/?d=4UYQ9TB6
Anyway, how to printf with kernel libc??
There's a way to do it? I won't use formatting...
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
Tested but why are you doing 2 allocations you can per alloc allocated 1 block
the list struct + the memory size asked.
example i do a malloc of 1024 the strucutre of the list is let say 16 bytes
i do one alloc of 16 bytes+1024 in the first bytes i put the next pointer and the id
and i return adrs allocate+16 to the application ;)
And another thing when you do a allocation always check de return code
if you've got a error (like out of memory) return null. Even with a linked list
you must be aware of error that can occur with the OS of the psp
the list struct + the memory size asked.
example i do a malloc of 1024 the strucutre of the list is let say 16 bytes
i do one alloc of 16 bytes+1024 in the first bytes i put the next pointer and the id
and i return adrs allocate+16 to the application ;)
And another thing when you do a allocation always check de return code
if you've got a error (like out of memory) return null. Even with a linked list
you must be aware of error that can occur with the OS of the psp
I don't mean to bash, but the last thing you need in the kernel partition is a contiguous lump of pre-allocated memory, half of which will probably lie unused by the application.
Either stick to allocating your bytes as an when you need them with the SCE functions, or allocate an intelligently calculated lump of memory and split it up yourself.
Otherwise you'll end with with ppl writing kernel plugins with PSP_HEAP_SIZE_KB(2048) and crap like that.
Either stick to allocating your bytes as an when you need them with the SCE functions, or allocate an intelligently calculated lump of memory and split it up yourself.
Otherwise you'll end with with ppl writing kernel plugins with PSP_HEAP_SIZE_KB(2048) and crap like that.
Ok, I've improved it to allocate one memory block, it works for me...
Take a look in the src, maybe there's something wrong...
http://www.megaupload.com/?d=EJTU4K1K
Take a look in the src, maybe there's something wrong...
http://www.megaupload.com/?d=EJTU4K1K
-
- Posts: 203
- Joined: Sat Jul 05, 2008 8:03 am
You have absolut reason torch. memory fragmentation is a hell look at this site
http://www.cs.umass.edu/~emery/hoard/
http://www.cs.umass.edu/~emery/hoard/