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 

SCRATCH PAD - Does the kernel use it ?

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



Joined: 10 Sep 2006
Posts: 750

PostPosted: Wed Nov 01, 2006 2:33 am    Post subject: SCRATCH PAD - Does the kernel use it ? Reply with quote

Hi,

PSP does have a scratch pad (0×00010000 - 0×00014000 (16 KiB)). Scratch pad is usually a faster memory than other memories. I was wondering if kernel or user libraries (i mean not ours) do really use it or it is eventually free for our purpose ? can it be cached ? or is it irrelevant ?
Back to top
View user's profile Send private message
jimparis



Joined: 10 Jun 2005
Posts: 1179
Location: Boston

PostPosted: Wed Nov 01, 2006 4:10 am    Post subject: Reply with quote

It's been said on IRC that the scratchpad ram ends up being no faster than normal ram on the PSP, haven't tested it myself though.
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Wed Nov 01, 2006 5:00 am    Post subject: Reply with quote

not slower too ?

well, I remember when I was working on SH1, there is another reason to use scratch pad : to avoid both instructions and data to be fetched from the external bus (DRAM here) by running instructions in scratch pad to make memory transfer faster. But, well, there was no cache and it was running at 10 MHz.
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Wed Nov 01, 2006 6:55 am    Post subject: Reply with quote

Based on the odd system diagram which Sony have put out it looks like scratchpad is not really internal to the CPU (like on most processors where it has that name) but actually somewhere on the external bus, so you dont even get normal speed + no bus access it seems :(
Back to top
View user's profile Send private message
ector



Joined: 12 May 2005
Posts: 195

PostPosted: Wed Nov 01, 2006 8:13 pm    Post subject: Reply with quote

At the presentation at BP2005, if I remember correctly, the presenter mentioned that there is a hardware bug that causes scratchpad RAM to be way slower than was intended. If it is separate from the CPU and actually is on the bus however as Tyranid says, I would call that bad design, not a bug :)
_________________
http://www.dtek.chalmers.se/~tronic/PSPTexTool.zip Free texture converter for PSP with source. More to come.
Back to top
View user's profile Send private message
groepaz



Joined: 01 Sep 2005
Posts: 305

PostPosted: Thu Nov 02, 2006 3:57 am    Post subject: Reply with quote

i have messed around with writing stuff to the scratchpad, and it didnt affect anything (atleast i didnt notice =D) and the data i wrote there also stayed unmodified...

but yeah its true, its not usefull for speedups (like it was on good old psx) :/
_________________
http://www.hitmen-console.org
http://hitmen.c02.at/files/yapspd/
Back to top
View user's profile Send private message Visit poster's website
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Thu Nov 02, 2006 4:11 am    Post subject: Reply with quote

Well there is a flag in CreateThread to allocate the stack on the scratch pad (think it is 1.5+ only) but none of the kernel threads use that flag afaik.
Back to top
View user's profile Send private message
hlide



Joined: 10 Sep 2006
Posts: 750

PostPosted: Thu Nov 02, 2006 6:05 pm    Post subject: Reply with quote

okay, to sum up :

1) scratch pad access is not more or less fast as main memory access due to the necessity for both to pass through an external bus. Sure, scratch pad sounds like a misname :/ and mostly a bad design rather than a bug indeed.

2) kernel doesn't use it, al least, for the running life of an application.

well, scratch pad still offers us 16 KiB for free.

By the way, do you know if GP is used by kernel ? by pspdev ? or can I set with my own address ?
Back to top
View user's profile Send private message
Exophase



Joined: 06 Nov 2006
Posts: 2

PostPosted: Mon Nov 06, 2006 3:58 pm    Post subject: Reply with quote

hlide wrote:
okay, to sum up :
By the way, do you know if GP is used by kernel ? by pspdev ? or can I set with my own address ?


GP is not a kernel register, but the compiler will use it to access global variables. You can set it to whatever you want, just be sure that when you call non-ASM functions to set it to whatever it was when you started running the assembly code.
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