bdpayne/libvmi — pull request #137 by tklengyel (2014-02-26 16:20:42+00:00)
Title: Towards multi-vCPU support for xen events

When having multiple vCPUs in a guest and using xen events certain information has to be provided to the user as extra. Foremost, knowing whether more events are pending when a callback is issued is critical, as clearing the event handler in a callback with more events waiting on the ring would cause LibVMI to fall through. Furthermore, in the current implementation LibVMI automatically resumes the domain's execution after an event is handled, which is undesirable when still having unprocessed events on the ring. Therefore in this PR I changed the event handling to only place the responses on the ring in the loop, and issue the resume after all requests are processed.

Further work is required to better determine when it is safe to remove an event handler through vmi_event_clear. We could either have a default setting where events are dropped when the handler is not found anymore, or provide more information to the user about pending events to have them make a more informed decision what they want to do with them. This would require us copying all pending events from Xen to a local storage and checking what type of events we have pending.