GP2X Dangerous Linux Hacking Code


how much of a speed improvement are we talking about?

I haven't measured it exactly but it is visually noticeable and easy to add to your code... It is only needed to call the MMU hacking table function after all mmap() done in your application. In Rlyeh minimal library it is needed to add the call at the end of the minimal library initialization function.

In MAME memory access to
- Video buffers.
- Extended memory (when loading biggest NeoGeo games).
changes from not cached to cached memory.

B)
 
Last edited by a moderator:
10-20fps? OMFG!
I wouldnt ever have guessed it would do so much of a difference.
I hope you get the issues sorted out.
 
I think I've got it working correctly, without crash.
What I've do is to put a 1sec pause at a specefic point:

Code:
lseek (gp2x_dev_mem, 0x6ec00, SEEK_SET);
write (gp2x_dev_mem, &newc1, 4);
write (gp2x_dev_mem, &newc2, 4);	

SDL_Delay(1000);

ttb = myuname(name);

I didn't get any crash with that :D

a beta is available here:
http://m.peponas.free.fr/gngeo/download/gngeo2x_0.6.12c.zip

PS: initial loading can be a little long (3/5 sec) and if the mmu patch fail, then you will no get no performance gain.
 
I think I've got it working correctly, without crash.
What I've do is to put a 1sec pause at a specefic point:

Code:
lseek (gp2x_dev_mem, 0x6ec00, SEEK_SET);
write (gp2x_dev_mem, &newc1, 4);
write (gp2x_dev_mem, &newc2, 4);	

SDL_Delay(1000);

ttb = myuname(name);

I didn't get any crash with that :D

a beta is available here:
http://m.peponas.free.fr/gngeo/download/gngeo2x_0.6.12c.zip

PS: initial loading can be a little long (3/5 sec) and if the mmu patch fail, then you will no get no performance gain.

Great! The initial loading will be a lot faster if you comment the trace to the terminal (//printf()...).
 
Last edited by a moderator:
I'm having troubles patching the mmu table. Sometimes the read() in DecodeCoarse is ok and sometimes bad... :(

Still investigating... :unsure:
 
I'm having troubles patching the mmu table. Sometimes the read() in DecodeCoarse is ok and sometimes bad... :(

Still investigating... :unsure:
try the delay trick I use (just before ttb=myuname), it's seems that there is some sort of cache that prevent the uname routine to be correctly overwrited. I tested it with a delay of 200ms and it work great so far.
 
Last edited by a moderator:
Wow! 15 fps more with this hack!
CONGRATULATIONS SQUIDGE

I don't know if I have used this hack correctly. I have made a function that's executed only one time after SDL is initialised.

Code:
void mmuhack()
{
				initphys();
		volatile unsigned int *myBuf = trymmap((void *)0, 65536, 3, 1, memfd, 0x03000000);
		volatile unsigned int *secbuf = (unsigned int *)malloc(204800);

		printf("mmaped 0x03000000 buffer @ VA: %08X malloc'd buffer @ VA: %08X\n", myBuf, secbuf);

		hackpgtable();

It's this correct?
And yes, I can improve it a bit xDD

PD: I'm using MMap function written in ASM by Dzz.
 
What I've do is to put a 1sec pause at a specefic point:

Code:
lseek (gp2x_dev_mem, 0x6ec00, SEEK_SET);
write (gp2x_dev_mem, &newc1, 4);
write (gp2x_dev_mem, &newc2, 4);	

SDL_Delay(200);

ttb = myuname(name);


Will this work too? I cant test it right now, im not at home

Code:
volatile u32 temp1,temp2;

lseek (gp2x_dev_mem, 0x6ec00, SEEK_SET);
read (gp2x_dev_mem, &temp1, 4);
read (gp2x_dev_mem, &temp2, 4);

lseek (gp2x_dev_mem, 0x6ec00, SEEK_SET);
write (gp2x_dev_mem, &newc1, 4);
write (gp2x_dev_mem, &newc2, 4);	

while(temp1 != newc1 && temp2 != newc2);

ttb = myuname(name);


PS: Squidge, amazing work as usual :) Congrats!
 
Last edited by a moderator:
:)

rlyeh: I don't think that'll work. I believe the problem to be something to do with caching, and Linux seems to do a task swap every 50ms, so you can either wait 100ms to be on the safe side, or flush the caches yourself using one of the special swi calls in the 0x9f000 range - check the kernel source for the exact number and the parameters. Of the two, I'd say waiting 100ms or so is the easiest :)
 
Good work, Squidge!

Unfortunately, I have pretty much 0 experience with anything outside of game programming with SDL, so I have no idea how to implement this into an SDL program. Would Waninkoko's solution work for me?
 
Back
Top