Miro Kropacek wrote:
Correct me if I'm wrong but we do have such instruction as well (removed in 68060) and it's called RTD (ReTurn and Deallocate). This is the primary reason how this question occurred to me, trap handler can easily check function number (as does right now), execute subroutine and return with RTD #size, where size would be read from some lookup table for each function number.
Ah, thanks, I had some idea about RTD, but I had not been able to find it in the docs. It is supported since 68010 and is still here on 68060.
http://www.freescale.com/files/32bit/doc/ref_manual/MC68060UM.pdfUnfortunately, RTD is not suitable for traps, because traps are exceptions and they push SR afer the return address (and also a format word on 68010+, and maybe some filler bytes on ColdFire). Also, the traps must be callable from user and supervisor mode, so they have to deal with the supervisor SP and USP...
So RTD is designed to implement stdcall on standard functions, not OS calls through traps.
And also, the TOS was designed for bare 68000, with no support for RTD. -- Vincent Rivière