]> rtime.felk.cvut.cz Git - jailhouse.git/blob - inmates/demos/x86/tiny-demo.c
inmates: Map Comm Region always at 0x100000 for inmates framework
[jailhouse.git] / inmates / demos / x86 / tiny-demo.c
1 /*
2  * Jailhouse, a Linux-based partitioning hypervisor
3  *
4  * Copyright (c) Siemens AG, 2013
5  *
6  * Authors:
7  *  Jan Kiszka <jan.kiszka@siemens.com>
8  *
9  * This work is licensed under the terms of the GNU GPL, version 2.  See
10  * the COPYING file in the top-level directory.
11  */
12
13 #include <inmate.h>
14
15 #ifdef CONFIG_UART_OXPCIE952
16 #define UART_BASE               0xe000
17 #else
18 #define UART_BASE               0x2f8
19 #endif
20
21 void inmate_main(void)
22 {
23         unsigned long long start, now;
24         int n;
25
26         printk_uart_base = UART_BASE;
27         printk("Hello from this tiny cell!\n");
28
29         start = read_pm_timer();
30         for (n = 0; n < 10; n++) {
31                 do {
32                         now = read_pm_timer();
33                         cpu_relax();
34                 } while (now - start < 1000000000ULL);
35                 start += 1000000000ULL;
36                 printk("PM Timer: %11lu\n", now);
37         }
38
39         asm volatile("hlt");
40 }