GP2X Idea To Ease 940 Programming


BradN

Active Member
Joined
Jun 22, 2003
Messages
577
How difficult would it be to create a call gate on the 920 which can process some system calls for the 940? Obviously things such as mmap would need to be simulated or disallowed because the hardware isn't there to make it effective, and process migration is probably out of the question, but many things (file access, generic pipes, etc) seem easy, and would be very useful.

Imagine if a renderer could load and intelligently cache graphics on the fly, without the 920 program (which tries not to deal with the specifics of which graphics are showing) needing to do anything special. If the 940 can anticipate textures that are almost being drawn, then preloading could be done, and loading jitter would be minimal.

Essentially, there would be a host process (or interrupt handler in more sophisticated design) on the 920 that serves as a representative of the 940 to linux. I assume that the 940 can be made to emulate the software interrupt that linux uses so that few software changes are needed to a 940 program.

If you look at multiprocessing design, it can be a big efficiency boost to allow requests to flow in both directions, but a debugging nightmare if not properly implemented.

Any thoughts or volunteers? :)
 
This is possible, but on the 940 side you would have to link some special code into whatever you're running.
 
Perhaps the host process could handle loading the executable into the 940 and setting up the code to link it. Going a step farther, the host process could handle shutting down the 940 when it is terminated, and doing some locking to avoid multiple use of the 940 or related race conditions.

In general, if the host process handles these tasks, it makes a single unit to modify when adding new features to the interlink, and it would lend itself to proper placement of functions between the two cores, since both sides are simultaneously accessible to the interlink programmer.

I guess the programming model would be like: "Want to use the 940? Start up a linux process and have the option of dealing with it as such, or use direct memory access or custom interfaces if it's better. Done using it? Terminate the linux process, or let it call exit itself through the link."

If the programming interfaces are clean enough, I think it would make code reuse (and use in general) for 940 programs more feasible. I think the 940 is a great complement to the 920 in this system, because it has no overhead or interruptions of a multitasking OS running directly on it, and maybe faster direct access to the hardware (no MMU). Yet, when the functions of an OS are desirable, it's still an option.
 
That's exactly what I do with LibGp2x - http://code.google.com/p/libgp2x/

It's dead easy to get a process running on the 940, and you get access to printf and related functions, as well as fopen, fread etc. The functions are far from complete, but they certainly show it works.

Andrew
 
Sweet, I figured the idea was so simple, it's may have already been done... I just wanted to increase some awareness :)
 
Back
Top