This is the mail archive of the crossgcc@cygnus.com mailing list for the crossgcc project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
> Is there are way to tell GCC to use an RTE instruction, instead of RTS, at > the end of a function used as an interrupt handler? A pragma perhaps? As others have pointed out, the normal way to do this is to use an assembly wrapper. On the 68K I have used two techniques to avoid needing a separate assembly wrapper for each exception. On most newer 68K CPU cores (starting with the 68010), the exception vector number is pushed onto the stack. All the vectors (other than reset, and possibly bus error and address error) can be pointed at a single assembly wrapper, which can extract the vector number from the stack and use it to index a table of pointers to C functions. On the original 68000, and cores derived from it (including the 6830x and 6832x), the vector number is not stacked. However, on most of these processors there is only a 24-bit address bus. I point all of the exception vectors to the same assembly wrapper, but with the vector number stored in the high byte. The wrapper can then use any of a number of techniques to extract the high byte of the PC, which can then be used for a table index. Note that in general I consider it to be very bad form to steal upper address bits in this fashion. Many programmers did this on the IBM 360, and it came back to bite them on the 370/XA. Having failed to learn a lesson from this, they did the same thing on the original Macintosh. However, in this specific case, it is only being done for processor models with a deficient architecture, and does not affect compatability with other processors. There are simply two different wrappers, and you pick the right one for the processor you are using. The high bits never get propogated or used beyond the assembly wrapper. Cheers, Eric