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 

change threads stack pointer

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



Joined: 18 Sep 2009
Posts: 24

PostPosted: Fri Nov 27, 2009 1:50 pm    Post subject: change threads stack pointer Reply with quote

Is there a way to change a kernel threads stack pointer? Iv tried using assembly and it just crashes the psp every time. I need about 2MB of stack.

Or would expanding the kernel partition work? iv tried using sctrlHENSetMemory to allocate 6MB to partition 8, my prx loaded fine but the stack was still allocated in partition 1 so that defeated the purpose.

thanks.
Back to top
View user's profile Send private message
Jim



Joined: 02 Jul 2005
Posts: 487
Location: Sydney

PostPosted: Fri Nov 27, 2009 8:58 pm    Post subject: Reply with quote

Someone might be able to help you, but can I ask why you would need such a huge stack and whether it might be possible to rethink your algorithm, either to do a recursive job in an iterative way or to use the heap instead?

Jim
_________________
http://www.dbfinteractive.com
Back to top
View user's profile Send private message Visit poster's website
bbtgp32465



Joined: 18 Sep 2009
Posts: 24

PostPosted: Fri Nov 27, 2009 10:33 pm    Post subject: Reply with quote

Well, a couple of threads back i started to try and reverse the ipl so i could get the kernel keys for psar dumper. (It isn't going to well =P)

So iv taken to loading the ipl in vram, patching some of the nasty parts that would cause a crash and executing the decryption parts like

sceDecypt1((void*)0xBFC00040, 0x280, (void*)seed1, (void*)seed2, (void*)main_bin, 0x8180);

Code:

   memset((void*)0x44000000, 0, 0x00200000);
   SceUID fd = sceIoOpen("host0:/ipl.mem", PSP_O_RDONLY, 0777);
   int size = sceIoLseek32(fd, 0, SEEK_END);
   sceIoLseek32(fd, 0, SEEK_SET);
   sceIoRead(fd, (void*)_VRAM(0x040EC000), size);
   sceIoClose(fd);


For this function i believe i need kernel mode and a huge stack because it freezes the psp when i run it. or maybe im just completely wrong and i cant run code from vram.

I have a couple more ideas but this was the easiest on the list. The next one is writing a program to rebase the ipl in user mode and modify sceMtInit etc to run. And after that is to write a program to generate an assembly version of the ipl that i can include in my project. Thats all for now
Back to top
View user's profile Send private message
TyRaNiD



Joined: 18 Jan 2004
Posts: 918

PostPosted: Sat Nov 28, 2009 2:43 am    Post subject: Reply with quote

You cannot change your stack pointer easily because if your thread context gets switched the thread manager will kill you because it thinks you blew your stack.

You might be able to get away with disabling interrupts while running the ipl code, with interrupts off the threads cannot context switch and you would _get away with it_ :)
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