aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorRusty Russell2015-02-11 15:15:09 +1030
committerRusty Russell2015-02-11 16:47:30 +1030
commit69a09dc1742ffbb3b02f3a1e03da4801e96452e9 (patch)
treec9887c6b6150810ba103b76cf9d4376af3edd5e5 /tools
parent18c137371b2ea86d263b75665a4904a0b8872990 (diff)
lguest: write more information to userspace about pending traps.
This is preparation for userspace handling MMIO and ioport accesses. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Diffstat (limited to 'tools')
-rw-r--r--tools/lguest/lguest.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/tools/lguest/lguest.c b/tools/lguest/lguest.c
index 3f7f2326cd9a..0e754d04876d 100644
--- a/tools/lguest/lguest.c
+++ b/tools/lguest/lguest.c
@@ -1820,17 +1820,21 @@ static void __attribute__((noreturn)) restart_guest(void)
static void __attribute__((noreturn)) run_guest(void)
{
for (;;) {
- unsigned long notify_addr;
+ struct lguest_pending notify;
int readval;
/* We read from the /dev/lguest device to run the Guest. */
- readval = pread(lguest_fd, &notify_addr,
- sizeof(notify_addr), cpu_id);
+ readval = pread(lguest_fd, &notify, sizeof(notify), cpu_id);
/* One unsigned long means the Guest did HCALL_NOTIFY */
- if (readval == sizeof(notify_addr)) {
- verbose("Notify on address %#lx\n", notify_addr);
- handle_output(notify_addr);
+ if (readval == sizeof(notify)) {
+ if (notify.trap == 0x1F) {
+ verbose("Notify on address %#08x\n",
+ notify.addr);
+ handle_output(notify.addr);
+ } else
+ errx(1, "Unknown trap %i addr %#08x\n",
+ notify.trap, notify.addr);
/* ENOENT means the Guest died. Reading tells us why. */
} else if (errno == ENOENT) {
char reason[1024] = { 0 };