Open thankfulmachine opened 1 year ago
CC @mshockwave
@llvm/issue-subscribers-backend-m68k
CC @mshockwave @0x59616e
I'll embark on this.
I guess one of the tasks of this issue and #64833 is to implement the calling convention of interrupt handler, right ? Is there any document or code regarding this ?
I guess one of the tasks of this issue and #64833 is to implement the calling convention of interrupt handler, right ? Is there any document or code regarding this ?
Did you check the »Literature« project here? https://github.com/M680x0/Literature
@0x59616e In case the literature provided does not answer your questions, I can reach out to some m68k experts on the mailing lists.
Let me know.
It seems that it doesn't require anything but a RTE at the end of the instruction sequence.
Description
The exception vector table exists in the first 1024 bytes of the address space, 256 long words in total. The first two are predefined to the the initial supervisor stack pointer and the initial program counter respectively. Clements, p. 448
Some are unassigned or reserved so, for forward compatibility, they should not be used as they can be defined in later 680x0 generations. See below for more information.
Tying Declarations to EVT Slots
Clang currently requires a single numeric argument to the
interrupt
attribute, presumably for the interrupt vector number, but this may not necessarily be required. It also arbitrarily limits the number to around 30, from what I can tell.Two usability points:
GCC has dealt with this via linker script in the past, as shown in this example linker script from m68k_bare_metal. I like this solution pretty well.
What can we do better?
Default Exception Implementation(s)
Some of these slots must be populated. What is the default implementation for an exception?
rte
?stop
? It might be good to let the user decide somehow (well known decl name?). FWIW, the bare metal project mentioned above uses:Example exception vector table (68000)
⭐️ These are filled with FPU and MMU conditions for later 680x0.