console/main/trap: enable interrupts, handle UART interrupt
This commit enables interrupts and configures the RISC-V PLIC to deliver
interrupts for the UART (interrupt 10 for qemu). To do this:
* mstatus and mie are configured for m-mode interrupts (mstatus also
likely has s-mode turned on, but we won't use s-mode until we have
to).
* The MmioSerialPort didn't have its init function called; doing so sets
the interrupt enable bits on the UART.
* Configures the PLIC to deliver interrupt 10 on priority 1.
* Adds code to the exception handler to claim, handle, and complete the
interrupt.
A few notes here:
* There's only one interrupt source right now...the UART. So servicing
the interrupt is done right in the handler. There's no need to
determine any other interrupt sources or worry about timing beyond
this, for now.
* Because the MmioSerialPort was really mostly set up for the benefit of
console output, it's not really set up to be used by the interrupt
handler. The code's a bit messy to ensure we read the pending byte
and just echo it back to the terminal. Future commits should address
the awkwardness going on here.