Thanks a bunch, Logan. That means the problems I'm seeing in my app might actually be caused by something I can fix; always a Good Thing.
Brandon On Thu, 17 Feb 2005 21:55:13 -0600, Logan Shaw <[EMAIL PROTECTED]> wrote: > Brandon Roberson wrote: > > Its my understanding that legacy Palm apps (m68k) are limited to jumps > > of 32767 bytes or less, as a signed 16-bit integer is used to > > represent the jump offset in the compiled code, limiting code > > resources to roughly 32k, more if you're careful about what order your > > functions are stored in. > > I think this is true only if you use the Small code model rather > than the Smart code model. The Smart code model should make > larger jumps possible, although because of the 64K limitation, > in practice you just think of it as 64K even if you have Smart > mode turned on. > > > Is native ARM code handled the same way, or are 32-bit values used for > > jump offsets? I'm using the Metrowerks PNOLoader library to patch > > together a half-meg of THUMB code, and I just wanted to make sure that > > I should be able to call functions freely within it. I've seen this > > technique used for PNOlets several megs in size, and I have a hard > > time imagining that the author went through and structured everything > > such that no piece of code ever called another piece of code more than > > 32767 bytes away. > > You can find some documentation at www.arm.com. They have a quick > reference guide to the Thumb instruction set (available at > http://www.arm.com/pdfs/QRC0001H_rvct_v2.1_thumb.pdf ), and > it shows 6 different conditional and unconditional branch > instructions. Branches are either relative or to the address > in a given register. I assume all compilers that produce PNOs > use relative branches exclusively within the PNO. There are > four relative branch Thumb instructions, and the ranges they > use are: > > [-252,+258] for conditional short branch, > [-2kB,+2kB] for unconditional short branch, and > [-4MB,+4MB] for the two types of long relative branches. > > Therefore, it seems safe to assume that if a PNO with a 3K branch is > OK, then a PNO with a 3.99MB branch is also OK, since they would have > to use the same mechanism. (At least, barring some weird compiler > behavior like computing its own branch destinations and then loading > that into a register, but that seems costly and pointless given what > instructions are available within Thumb.) > > - Logan > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please > see http://www.palmos.com/dev/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
