]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
inmates: Add cell_status support to apic-demo
authorJan Kiszka <jan.kiszka@siemens.com>
Thu, 16 Jan 2014 16:26:29 +0000 (17:26 +0100)
committerJan Kiszka <jan.kiszka@siemens.com>
Thu, 16 Jan 2014 16:26:29 +0000 (17:26 +0100)
Demonstrate the usage of the cell_status field in the comm region by
performing a self-shutdown after the first shutdown request.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates/apic-demo.c

index 3f81a3ad1a8194650f3ec5e259d145b628fc50c8..67413fba9ffb7c57c6b2ed2327373efa192e2089 100644 (file)
@@ -126,6 +126,8 @@ static void init_apic(void)
 
 void inmate_main(void)
 {
+       unsigned int n;
+
        printk_uart_base = UART_BASE;
 
        if (init_pm_timer())
@@ -138,10 +140,11 @@ void inmate_main(void)
        jailhouse_send_reply_from_cell(comm_region,
                                       JAILHOUSE_MSG_SHUTDOWN_DENIED);
 
-       while (comm_region->msg_to_cell != JAILHOUSE_MSG_SHUTDOWN_REQUESTED)
+       for (n = 0; n < 10; n++)
                asm volatile("hlt");
 
        printk("Stopped APIC demo\n");
-       jailhouse_send_reply_from_cell(comm_region, JAILHOUSE_MSG_SHUTDOWN_OK);
+       comm_region->cell_status = JAILHOUSE_CELL_SHUT_DOWN;
+
        asm volatile("cli; hlt");
 }