At 11:04 AM +1200 2002/06/27, Hemon Dey wrote: >How do RAM patches work? that's probably quite a complicated question ... >but in simplistic terms, does the OS reference some bits of RAM memory >everytime it executes, and the patches update these memory locations?
A complicated question indeed(!) And writing, building, and distributing a patch is even more-so... but, in simplistic terms: The 68k version of Palm OS uses an unimplemented trap opcode (with a corresponding exception handler) and a single function dispatch table located in RAM to access the implementations of each API function. This table contains function addresses filled in as various components of the OS initialize themselves. RAM patches simply change entries in the table to point to new implementations of the routines. The new routines are usually located in protected storage heap RAM as part of the patch prc. Sometimes the new routines are copied into the dynamic heap, for example, when the patch needs access to its own globals and/or must call through to the original implementation... it has to remember the original implementation's function address, which is usually done by reserving a few bytes in some assembly glue code for the replacement function. Think of it as an alternative to using the feature manager to store the call-through address which provides much better performance and is interrupt-service-routine safe. :o) So patches act at the public API level, not at the "these bytes somewhere in memory needs changing" level. The latter approach requires an MMU and some very complex and often device-dependent page table modifications (among other things). Thus we have no plans to (ever?) provide that level of granularity to patches. Best Regards, Jim Schram PalmSource Inc. Partner Engineering -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
