Question about RAM?

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

Moderators: cheriff, TyRaNiD

Post Reply
Rangu2057
Posts: 87
Joined: Mon Jul 23, 2007 8:37 am
Location: wilmington, NC

Question about RAM?

Post by Rangu2057 »

im curious to know if its possible for a prx to be coded that would partition a little block of memory on the memory stick to use as a reserve backup in case RAM is all used up, is it possible?

I had asked this because of the issue with the fat psp (32MB) not having enough RAM for some apps, unlike the slim which has plenty of room in its RAM (62MB)
the questions of today are awnswered by the blood and bullets of tomorrow! ---EagleEye--- (Socom FTB2)
jimparis
Posts: 1145
Joined: Fri Jun 10, 2005 4:21 am
Location: Boston

Post by jimparis »

No, without a proper MMU you can't do it in a way that's transparent to applications.
M.Jackson
Posts: 85
Joined: Mon Sep 10, 2007 6:37 pm
Contact:

Post by M.Jackson »

Well, theoretically speaking this is still possible but just highly impractical. You can still "map" part of the memory stick into an address space outside the physical RAM. As a result, any attempt to access that range will immediately trigger a bus error which could be caught by a special exception handler in which you can complete the access by transfering data from the memory stick to the target register of the offending instruction (or the other way around). But obviously the drawback of this is that every instruction that tries to access the mapped space will demand one call to the exception handler making it virtually no different from running every of those instructions in a simulator. And if such access is frequent, this could consume significant amount of CPU time dramatically degrading the performance of your code.
J.F.
Posts: 2906
Joined: Sun Feb 22, 2004 11:41 am

Post by J.F. »

What he wants sounds more like app-level memory management in any case. That is something that is specific to every app. Since apps use memory in different ways, a different handling of low memory would be needed for every app. Simply setting aside a small block of RAM would make no difference to the vast majority of apps as they are now.
hlide
Posts: 739
Joined: Sun Sep 10, 2006 2:31 am

Post by hlide »

this could be done through handles :

mem_handle_t halloc(int size) : return a handle to a memory block

void hfree(mem_handle_t mh) : free a memory block and invalidate handle

void *haquire/hlock(mem_handle_t mh) : if memory block is already in RAM, return the locked address of the memory block. If not, try to allocate an unlocked memory block of the right size and read from MS after saving the old contents in MS and return the new locked address of the memory block.

void hrelease/hunlock(mem_handle_t mh) : unlock the memory block so it can be swap to MS if necessary. The address is not valid any longer so you need to use haquire/hlock again to get a new valid address.

it reminds me of Win16
User avatar
jean
Posts: 489
Joined: Sat Jan 05, 2008 2:44 am

Post by jean »

mmhhhh.....seems like an unsatisfied skype user to me... :)))))
Rangu2057
Posts: 87
Joined: Mon Jul 23, 2007 8:37 am
Location: wilmington, NC

Post by Rangu2057 »

thanks for the reply guys as i've had this question on my mind for a long time :) I still wonder why i never asked when the question came to me :/

i am a little pissed about skype only on the slim, but im happy as long as i can play homebrew on my psp :)
the questions of today are awnswered by the blood and bullets of tomorrow! ---EagleEye--- (Socom FTB2)
Post Reply