buffer.lua: Fix in deref().
port.lua: Updated the echo() test function to use the current I/O API.
virtio.lua: Updated to the new I/O API and fixed bugs.

selftest now calls into port.lua's echo test.