aboutsummaryrefslogtreecommitdiffstats
path: root/tools/lguest/lguest.c
diff options
context:
space:
mode:
authorRusty Russell <rusty@rustcorp.com.au>2015-02-10 23:45:09 -0500
committerRusty Russell <rusty@rustcorp.com.au>2015-02-11 01:17:30 -0500
commit69a09dc1742ffbb3b02f3a1e03da4801e96452e9 (patch)
treec9887c6b6150810ba103b76cf9d4376af3edd5e5 /tools/lguest/lguest.c
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/lguest/lguest.c')
-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)
1820static void __attribute__((noreturn)) run_guest(void) 1820static void __attribute__((noreturn)) run_guest(void)
1821{ 1821{
1822 for (;;) { 1822 for (;;) {
1823 unsigned long notify_addr; 1823 struct lguest_pending notify;
1824 int readval; 1824 int readval;
1825 1825
1826 /* We read from the /dev/lguest device to run the Guest. */ 1826 /* We read from the /dev/lguest device to run the Guest. */
1827 readval = pread(lguest_fd, &notify_addr, 1827 readval = pread(lguest_fd, &notify, sizeof(notify), cpu_id);
1828 sizeof(notify_addr), cpu_id);
1829 1828
1830 /* One unsigned long means the Guest did HCALL_NOTIFY */ 1829 /* One unsigned long means the Guest did HCALL_NOTIFY */
1831 if (readval == sizeof(notify_addr)) { 1830 if (readval == sizeof(notify)) {
1832 verbose("Notify on address %#lx\n", notify_addr); 1831 if (notify.trap == 0x1F) {
1833 handle_output(notify_addr); 1832 verbose("Notify on address %#08x\n",
1833 notify.addr);
1834 handle_output(notify.addr);
1835 } else
1836 errx(1, "Unknown trap %i addr %#08x\n",
1837 notify.trap, notify.addr);
1834 /* ENOENT means the Guest died. Reading tells us why. */ 1838 /* ENOENT means the Guest died. Reading tells us why. */
1835 } else if (errno == ENOENT) { 1839 } else if (errno == ENOENT) {
1836 char reason[1024] = { 0 }; 1840 char reason[1024] = { 0 };