monitor: implement IO for monitor console
This commit introduces the basic infrastructure for the monitor console,
specifically providing some basic line-oriented IO so that the monitor
(to be styled after Wozmon) can be written easily.
This refactors out some of the aspects of the UART code into a
UartConsole that can pe paired with a line-oriented "application". This
also changes the creation of the TrapFrame into a heap allocation
through Box. This is necessary because the UartConsole is owned by the
TrapFrame. That sounds awkward, but the interrupt handler is currently
the only code path from the "outside world" to reach the UartConsole.
It's not possible to "plug in" the monitor if the TrapFrame is
statically initialized, so it instead comes from the heap.
Because both UartConsole and Monitor need to refer to one another in an
abstracted way, one can't really own the other. The solution here is to
use Arc::new_cyclic so that reference counting can help the compiler
prove that memory won't leak.
The UART handling code is now a little awkward-looking; there's still a
global static Uart for the println!() macros but then an instantiated
UartConsole, too. Longer-term, the goal will be to get rid of the
global Uart object and make the println!() macro part of a more
comprehensive console management system.