]> rtime.felk.cvut.cz Git - jailhouse.git/blob - inmates/lib/x86/inmate.h
85e1616655c51692aeb466a9a8d4a533c09f641c
[jailhouse.git] / inmates / lib / x86 / inmate.h
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 #define FSEGMENT_BASE   0xf0000
14
15 #define INMATE_CS32     0x8
16 #define INMATE_CS64     0x10
17 #define INMATE_DS32     0x18
18
19 #ifndef __ASSEMBLY__
20 typedef signed char s8;
21 typedef unsigned char u8;
22
23 typedef signed short s16;
24 typedef unsigned short u16;
25
26 typedef signed int s32;
27 typedef unsigned int u32;
28
29 typedef signed long s64;
30 typedef unsigned long u64;
31
32 typedef s8 __s8;
33 typedef u8 __u8;
34
35 typedef s16 __s16;
36 typedef u16 __u16;
37
38 typedef s32 __s32;
39 typedef u32 __u32;
40
41 typedef s64 __s64;
42 typedef u64 __u64;
43
44 typedef enum { true=1, false=0 } bool;
45
46 #include <jailhouse/hypercall.h>
47
48 static inline void cpu_relax(void)
49 {
50         asm volatile("rep; nop" : : : "memory");
51 }
52
53 static inline void outb(u8 v, u16 port)
54 {
55         asm volatile("outb %0,%1" : : "a" (v), "dN" (port));
56 }
57
58 static inline u8 inb(u16 port)
59 {
60         u8 v;
61         asm volatile("inb %1,%0" : "=a" (v) : "dN" (port));
62         return v;
63 }
64
65 static inline u32 inl(u16 port)
66 {
67         u32 v;
68         asm volatile("inl %1,%0" : "=a" (v) : "dN" (port));
69         return v;
70 }
71
72 extern unsigned int printk_uart_base;
73 void printk(const char *fmt, ...);
74
75 void *memset(void *s, int c, unsigned long n);
76
77 extern u8 irq_entry[];
78 void irq_handler(void);
79
80 void inmate_main(void);
81
82 unsigned long read_pm_timer(struct jailhouse_comm_region *comm_region);
83 #endif