[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Lisp interrupt handlers?
- To: firstname.lastname@example.org
- Subject: Re: Lisp interrupt handlers?
- From: Gary Byers <email@example.com>
- Date: Wed, 14 Nov 1990 16:19:22 EST
- Cc: firstname.lastname@example.org
- In-reply-to: Your message of Wed, 14 Nov 90 1:22:58 EST
> Hi all,
> I'm trying to write something that does interrupt-level callbacks into
> Lisp (to handle IO completion routines) via defpascal. Despite being
> careful about consing, locking memory, and so on, I am getting
> precisely what I deserve, which is that the program usually works
> but occasionally does something impressively random. So, I assume
> functions defined with defpascal count on being called only when Lisp
> is the active application (did I mention that this needs to run under
> Multifinder?), and don't set up the lisp environment.
Functions defined by defpascal rely on being called "synchronously" -
they reestablish context (stack pointers, etc.) which was saved when the
lisp last called the ROM or a foreign function. I believe that, in
1.3 at least, they also implicitly assume that A5 is lisp's.
> Anybody managed to do this? Or, could anyone describe _exactly_ what
> defpascal does? Anything need to be set up other than A5, the value
> stack pointer, NILREG, and TREG?? Whee.
If you can think of a way to reliably recover the value of the value stack
pointer (A6) at interrupt time, I'd be interested. A lot of the
"impressive randomness" you observe can probably be traced to the
fact that functions defined by defpascal reinitialize the VSP to
the value it had as of the last trap or foreign function call.
For this and other reasons, I think you'll find it easier to try and
do the interrupt-level callbacks in some language other than Lisp.
I know that some people have done this (either using the FFI or "hand
assembly") in the case of the MIDI Manager; you might want to talk
to Joe Chung (email@example.com) about this.
> Thanks much for any help....
To the extent that this -is- help, you're welcome ...