I added a monitor printf() function, so we can spew
debug information independent of which space we are in.
Kind of an analog to printk() in the Linux kernel.
I allocate N pages. Text wraps when an overflow occurs
and a wrap counter is incremented so this can be reported.
This output is redirected to printk() only when back in
the host kernel module, and after a hardware redirect
has been serviced.
Using printk() directly A) does not work in both
address spaces, and B) is not so good between
a HW interrupt in the monitor and it's redirection
to the host. The new facility solves this.
I'm modifying the code so that we map guest physical
pages into the monitor/guest address space on demand.
This is useful logic to have in order to allow us
to mark some of the guest memory as host-swappable.
Well, actually the page fault handler to do this
was no problem, but...
Using this technique, we can't count on pages of
guest memory being accessible by the monitor. For
now it's only because I start out with no guest phy
mapped in, but later it could be because certain
pages are marked as host-swappable. In this case,
we must redirect back to the host to handle the
situation. So, we have to rehash code in kernel/emulation.c
to always check ranges of guest memory, to see if
they are accessible or not. If not, we have to
redirect back to the host. Kind of like a verify_area()
in Linux. No big deal, just have to have a good
habit of verifying address ranges before examining the
data.
I'm looking into doing this now. If we don't do it
now, it will become harder to do later.
-Kevin