[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

user-written interrupt handlers



Boy do I feel stupid... Here I am, pondering how to write a new GEMDOS function
that will allow an interrupt handler to send a signal to a user process, when
it suddenly hits me - if the interrupt occurs while we're already in the kernel,
we get the original TOS trap handlers. Sheesh!

About the only thing I can think of now is to doctor up the Setexc XBIOS call,
so that it wraps a bit of code around whatever the user supplies. But, in
that case, the actual address that the interrupt vector points to will be
different from the address of the user-supplied routine, possibly causing more
confusion. The actual wrapper just needs to build a context and see if we're in
the kernel. If so, remember it and leave the kernel, then call the user routine,
and re-enter the kernel if necessary, before returning...

Without this check, there's no way a user-supplied interrupt handler can be
sure of having MiNT's services available at interrupt time. Trying to solve
the problem any other way would seem to require the user code to muck around
trying to decode MiNT's symbol table to find the very same info...

Comments? Should Setexc be munged in MiNT, or should this be a new function,
or is there a better way?