aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/lguest.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/lguest.h')
-rw-r--r--include/linux/lguest.h85
1 files changed, 85 insertions, 0 deletions
diff --git a/include/linux/lguest.h b/include/linux/lguest.h
new file mode 100644
index 000000000000..500aace21ca7
--- /dev/null
+++ b/include/linux/lguest.h
@@ -0,0 +1,85 @@
1/* Things the lguest guest needs to know. Note: like all lguest interfaces,
2 * this is subject to wild and random change between versions. */
3#ifndef _ASM_LGUEST_H
4#define _ASM_LGUEST_H
5
6#ifndef __ASSEMBLY__
7#include <asm/irq.h>
8
9#define LHCALL_FLUSH_ASYNC 0
10#define LHCALL_LGUEST_INIT 1
11#define LHCALL_CRASH 2
12#define LHCALL_LOAD_GDT 3
13#define LHCALL_NEW_PGTABLE 4
14#define LHCALL_FLUSH_TLB 5
15#define LHCALL_LOAD_IDT_ENTRY 6
16#define LHCALL_SET_STACK 7
17#define LHCALL_TS 8
18#define LHCALL_SET_CLOCKEVENT 9
19#define LHCALL_HALT 10
20#define LHCALL_GET_WALLCLOCK 11
21#define LHCALL_BIND_DMA 12
22#define LHCALL_SEND_DMA 13
23#define LHCALL_SET_PTE 14
24#define LHCALL_SET_PMD 15
25#define LHCALL_LOAD_TLS 16
26
27#define LG_CLOCK_MIN_DELTA 100UL
28#define LG_CLOCK_MAX_DELTA ULONG_MAX
29
30#define LGUEST_TRAP_ENTRY 0x1F
31
32static inline unsigned long
33hcall(unsigned long call,
34 unsigned long arg1, unsigned long arg2, unsigned long arg3)
35{
36 asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY)
37 : "=a"(call)
38 : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3)
39 : "memory");
40 return call;
41}
42
43void async_hcall(unsigned long call,
44 unsigned long arg1, unsigned long arg2, unsigned long arg3);
45
46/* Can't use our min() macro here: needs to be a constant */
47#define LGUEST_IRQS (NR_IRQS < 32 ? NR_IRQS: 32)
48
49#define LHCALL_RING_SIZE 64
50struct hcall_ring
51{
52 u32 eax, edx, ebx, ecx;
53};
54
55/* All the good stuff happens here: guest registers it with LGUEST_INIT */
56struct lguest_data
57{
58/* Fields which change during running: */
59 /* 512 == enabled (same as eflags) */
60 unsigned int irq_enabled;
61 /* Interrupts blocked by guest. */
62 DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
63
64 /* Virtual address of page fault. */
65 unsigned long cr2;
66
67 /* Async hypercall ring. 0xFF == done, 0 == pending. */
68 u8 hcall_status[LHCALL_RING_SIZE];
69 struct hcall_ring hcalls[LHCALL_RING_SIZE];
70
71/* Fields initialized by the hypervisor at boot: */
72 /* Memory not to try to access */
73 unsigned long reserve_mem;
74 /* ID of this guest (used by network driver to set ethernet address) */
75 u16 guestid;
76 /* KHz for the TSC clock. */
77 u32 tsc_khz;
78
79/* Fields initialized by the guest at boot: */
80 /* Instruction range to suppress interrupts even if enabled */
81 unsigned long noirq_start, noirq_end;
82};
83extern struct lguest_data lguest_data;
84#endif /* __ASSEMBLY__ */
85#endif /* _ASM_LGUEST_H */