]> rtime.felk.cvut.cz Git - jailhouse.git/commitdiff
inmates: Add primitive 32-bit demo
authorJan Kiszka <jan.kiszka@siemens.com>
Thu, 17 Jul 2014 19:24:58 +0000 (21:24 +0200)
committerJan Kiszka <jan.kiszka@siemens.com>
Mon, 21 Jul 2014 06:53:05 +0000 (08:53 +0200)
This only demonstrates the capability to build inmates which come up in
32-bit mode. Note that not all library services support this already.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
inmates/demos/x86/32-bit-demo.c [new file with mode: 0644]
inmates/demos/x86/Makefile

diff --git a/inmates/demos/x86/32-bit-demo.c b/inmates/demos/x86/32-bit-demo.c
new file mode 100644 (file)
index 0000000..c0dc5a7
--- /dev/null
@@ -0,0 +1,30 @@
+/*
+ * Jailhouse, a Linux-based partitioning hypervisor
+ *
+ * Copyright (c) Siemens AG, 2014
+ *
+ * Authors:
+ *  Jan Kiszka <jan.kiszka@siemens.com>
+ *
+ * This work is licensed under the terms of the GNU GPL, version 2.  See
+ * the COPYING file in the top-level directory.
+ *
+ *
+ * Use with tiny-demo config e.g.
+ */
+
+#include <inmate.h>
+
+#ifdef CONFIG_UART_OXPCIE952
+#define UART_BASE              0xe000
+#else
+#define UART_BASE              0x2f8
+#endif
+
+#define IA32_EFER      0xc0000080
+
+void inmate_main(void)
+{
+       printk_uart_base = UART_BASE;
+       printk("This runs in 32-bit mode (EFER: %x)\n", read_msr(IA32_EFER));
+}
index 1397c800ef0ee9d69b4d01d55594d8ccf12cd090..7794b878b670943fb6d3d20708c484750353419b 100644 (file)
@@ -14,7 +14,7 @@ include $(INMATES_LIB)/Makefile.lib
 
 LIBDIR := ../../lib/x86
 
-INMATES := tiny-demo.bin apic-demo.bin ioapic-demo.bin
+INMATES := tiny-demo.bin apic-demo.bin ioapic-demo.bin 32-bit-demo.bin
 
 tiny-demo-y := tiny-demo.o \
        $(LIBDIR)/header.o $(LIBDIR)/printk.o $(LIBDIR)/timing.o
@@ -27,4 +27,8 @@ ioapic-demo-y := ioapic-demo.o \
        $(LIBDIR)/header.o $(LIBDIR)/printk.o $(LIBDIR)/mem.o \
        $(LIBDIR)/int.o $(LIBDIR)/ioapic.o
 
+$(eval $(call DECLARE_32_BIT,32-bit-demo))
+32-bit-demo-y := 32-bit-demo.o \
+       $(LIBDIR)/header-32.o $(LIBDIR)/printk-32.o
+
 $(eval $(call DECLARE_TARGETS,$(INMATES)))