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