[Vm-dev] FFI callback for interrupts in Raspberry

Eliot Miranda eliot.miranda at gmail.com
Mon Feb 19 15:20:15 UTC 2018

Hi Denis,

> On Feb 19, 2018, at 6:35 AM, Denis Kudriashov <dionisiydk at gmail.com> wrote:
> Hi.
> I am experimenting with interrupt callbacks on Rasperry. I am using WiringPi library which allows to set the function which should be called when value of particular pin is changed.
> But instead of callback execution I got following message in the console:
> Warning; callback failed to own the VM
> So VM is not crashed. But every interrupt produces such message.
> Is it related to the fact that callback is triggered from the thread different from VM? (I not sure about such detail, just guessing)

Indeed it is.  You would need to either
- arrange that interrupts are delivered on the VM thread, e.g. by responding to the interrupt on the foreign thread by queueing the information, and using the external semaphore support to inform the image of the interrupt
- help us finish the threaded FFI so that the callback can be received from the foreign thread
- find out how a SqueakNOS VM handles receiving an interrupt at any time, or specific times (IIRC the Digitalk VM required the image to execute an enableInterrupts and a disableInterrupts bytecode around code that was executed when the VM is used n a state to take interrupts.

The thing I do not understand about SqueakNOS and responding to an interrupt at an arbitrary time is how one expects to deal with handling an interrupt during some sequence of instructions that is between suspension points, such as mid way through a store check which is adding an object to the remembered set, or mid way through a message lookup.  Does SqueakNOS actually use the enable/disable interrupts approach?

Denis, can you describe the callbacks in more detail?  What is their favorite nation? Must they be responded to immediately? 

> Best regards
> Denis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20180219/6ce4221b/attachment.html>

More information about the Vm-dev mailing list