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 

Heap addresses on the PSP

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



Joined: 28 Sep 2005
Posts: 217

PostPosted: Fri Oct 21, 2005 8:57 am    Post subject: Heap addresses on the PSP Reply with quote

I've been experimenting with trying to make the 2.0 EBOOT loader a little more stable.

One of my main concerns is that I do very little in the way of memory management - just assuming that I can write to pretty much anywhere in the main user memory partition (0x08800000 + ).

It occurred to me that maybe I could allocate the memory I'm using, to avoid clashes with other code.

I used this code to experiment with allocating memory in the area I want, but just get SCE_KERNEL_ERROR_MEMBLOCK_ALLOC_FAILED errors on every block:

char *lname = "testmem";
SceUID lblockid;
char *lptr = (char*)0x08900000L;

while ((unsigned long)lptr < 0x08A00000L)
{
lblockid = sceKernelAllocPartitionMemory(2, lname, 2, 0x1000, (void*)lptr);
if ((unsigned long)lblockid != 0x800200d9)
{
printf("Managed to alloc @ %08lX ID %08lX\n", lptr, lblockid);
}
lptr += 0x1000;
}

I also tried this code to identify the lowest address I can allocate:

lblockid = sceKernelAllocPartitionMemory(2, lname, 0, 0x1000, 0)

but the lowest address is gives me is around 0x09C00000, which isn't far short of my stack.

This is all on v2.0, and I don't have access to a 1.5 PSP to see if things are any different there.

What I was wondering is:

- is the heap always so high in the address space?
- is it really only about 2Mb in size?

It seems that, quite apart from trying to make things more stable in general, this might be the reason why some apps are crashing under the loader at the moment, especially some LUA scripts which seem to fail after loading a few images.

P.S. Any tips for locating blocks of memory that I could steal back from the system? I noticed that blockids are always offset from each other at a multiple of 0x8FE, but scanning around about 100 IDs either side of the ones I get from the alloc calls doesn't seem to yield any addresses that are significantly different.
Back to top
View user's profile Send private message
Fanjita



Joined: 28 Sep 2005
Posts: 217

PostPosted: Mon Oct 24, 2005 11:20 pm    Post subject: Reply with quote

Never mind, I just went ahead and implemented some hooks into the memory allocation calls, and added my own supplementary memory manager.

Seems to work pretty well.
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