virtIO devices crashing early
As mentioned from #70 , in the virtio example if console.c is invoked too early to handle the receiving of characters, this can cause the VMM to crash. This is due to the serial system notifying the VMM client and its processing that by accessing the virtqueues before it is initialised.
We should at least be checking the DRIVER_OK bit before doing anything.
We also wrongly assume that the guest-physical address we're copying out of/into from virtIO descriptors is valid. We should be checking that they always lie within guest RAM.
I've changed the title since I think it affects multiple virtIO devices we have in libvmm.
To solve this we should:
- add checks in
src/mmio.cto not invoke the callbacks registered by a virtIO device unless we have gotten theDRIVER_OKbit. - add asserts in each virtIO device to make sure all initialisation has occurred
- Also be validating guest addresses given to us by the guest in the descriptor rings.