----- Original Message ----- From: "Ben Combee" <[EMAIL PROTECTED]> Newsgroups: palm-dev-forum To: "Palm Developer Forum" <[EMAIL PROTECTED]> Sent: Friday, October 05, 2001 9:52 AM Subject: Re: I have a newbie question
> "Wayne" <[EMAIL PROTECTED]> wrote in message > news:64245@palm-dev-forum... > > > > It's my understanding that when a program is on the palm it is > executed from > > where it is at in memory, but where it is at is determined by the OS > when it > > was loaded (can I use that word?) onto the palm, so it really doesn't > know > > where it is at. Correct? > > > > The OS doesn't do any relocating the program once its in memory, > therefore > > the program remains the same from when it was assembled and converted > to > > .prc format on the development computer to when it is loaded into the > palm's > > memory. Correct? > > > > So my questions are: > > How do calls and jumps work? Is the code for the subroutine called > relative > > to where the PC is at currently? It seems it would have to be. > > Most calls and jumps are made using PC-relative instructions. While the > code doesn't know exactly where its jumping, it knows how far from the > current instruction the code its referencing is. > > A jump to another segment is made through a segment jump table. This is > a table setup in the global variable space that gets fixed at program > start time with the addresses of any functions called from a different > segment. To make a cross segment jump, the code jumps into the table, > which has another jump instruction that forwards to the destination. So this would be used to get around the code size limitations? > > Global data is referenced as an offset from the A5 register. This > offset is set at build time by the linker. A5 is setup by the OS to > point into the middle of the data region, which is allocated on the heap > and setup at program start time. > Does the A5 register remain fixed during execution? (ie: Am I not allowed to change it?) > > > > -- > For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/ > -- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/tech/support/forums/
