On Fri, 16 Dec 2011 09:40:42 -0800 Eliot Miranda eliot.miranda@gmail.com wrote:
it's smetimes helpful to look at other systems' approaches. In VisualWorks there is no special interrupt handling in the VM; the keyboard event comes in like any other:
I've always had a strong aversion to sending control and data on the same channel. (vis. Capn' Crunch, SQL injection, XSS) While I don't think we've got those sorts of nasties, I like control and data well differentiated as a matter of principle. Here's an idea which preserves backward compatibility with old images, and permits multiple attention keys: let primSetInterruptKey take either an integer or an array of integers. The VM makes a list of the keys passed; the list has only one element if an integer is passed. When a key in the list is encountered, the VM records that in a buffer (only the most recent attention key is remembered), and sends the semaphore in the current fashion. Create a new primitive to read the buffer. The advantage is that existing images still work, while newer images can set multiple attn. keys, and they can dispatch them appropriately after finding out which key was hit.