lguest.h 2.3 KB
Newer Older
R
Rusty Russell 已提交
1 2 3 4
/*
 * Things the lguest guest needs to know.  Note: like all lguest interfaces,
 * this is subject to wild and random change between versions.
 */
5 6
#ifndef _LINUX_LGUEST_H
#define _LINUX_LGUEST_H
R
Rusty Russell 已提交
7 8

#ifndef __ASSEMBLY__
9
#include <linux/time.h>
R
Rusty Russell 已提交
10
#include <asm/irq.h>
11
#include <asm/lguest_hcall.h>
R
Rusty Russell 已提交
12

R
Rusty Russell 已提交
13 14 15
#define LG_CLOCK_MIN_DELTA	100UL
#define LG_CLOCK_MAX_DELTA	ULONG_MAX

R
Rusty Russell 已提交
16 17
/*G:031
 * The second method of communicating with the Host is to via "struct
R
Rusty Russell 已提交
18
 * lguest_data".  Once the Guest's initialization hypercall tells the Host where
R
Rusty Russell 已提交
19 20
 * this is, the Guest and Host both publish information in it.
:*/
21
struct lguest_data {
R
Rusty Russell 已提交
22 23 24 25
	/*
	 * 512 == enabled (same as eflags in normal hardware).  The Guest
	 * changes interrupts so often that a hypercall is too slow.
	 */
R
Rusty Russell 已提交
26
	unsigned int irq_enabled;
R
Rusty Russell 已提交
27
	/* Fine-grained interrupt disabling by the Guest */
R
Rusty Russell 已提交
28 29
	DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);

R
Rusty Russell 已提交
30 31
	/*
	 * The Host writes the virtual address of the last page fault here,
R
Rusty Russell 已提交
32
	 * which saves the Guest a hypercall.  CR2 is the native register where
R
Rusty Russell 已提交
33 34
	 * this address would normally be found.
	 */
R
Rusty Russell 已提交
35 36
	unsigned long cr2;

37 38 39
	/* Wallclock time set by the Host. */
	struct timespec time;

R
Rusty Russell 已提交
40 41 42 43
	/*
	 * Interrupt pending set by the Host.  The Guest should do a hypercall
	 * if it re-enables interrupts and sees this set (to X86_EFLAGS_IF).
	 */
44 45
	int irq_pending;

R
Rusty Russell 已提交
46 47
	/*
	 * Async hypercall ring.  Instead of directly making hypercalls, we can
R
Rusty Russell 已提交
48
	 * place them in here for processing the next time the Host wants.
R
Rusty Russell 已提交
49 50
	 * This batching can be quite efficient.
	 */
R
Rusty Russell 已提交
51 52

	/* 0xFF == done (set by Host), 0 == pending (set by Guest). */
R
Rusty Russell 已提交
53
	u8 hcall_status[LHCALL_RING_SIZE];
R
Rusty Russell 已提交
54
	/* The actual registers for the hypercalls. */
J
Jes Sorensen 已提交
55
	struct hcall_args hcalls[LHCALL_RING_SIZE];
R
Rusty Russell 已提交
56

R
Rusty Russell 已提交
57
/* Fields initialized by the Host at boot: */
R
Rusty Russell 已提交
58 59
	/* Memory not to try to access */
	unsigned long reserve_mem;
R
Rusty Russell 已提交
60 61
	/* KHz for the TSC clock. */
	u32 tsc_khz;
62 63
	/* Page where the top-level pagetable is */
	unsigned long pgdir;
R
Rusty Russell 已提交
64

R
Rusty Russell 已提交
65
/* Fields initialized by the Guest at boot: */
R
Rusty Russell 已提交
66 67
	/* Instruction range to suppress interrupts even if enabled */
	unsigned long noirq_start, noirq_end;
68 69
	/* Address above which page tables are all identical. */
	unsigned long kernel_address;
70 71
	/* The vector to try to use for system calls (0x40 or 0x80). */
	unsigned int syscall_vec;
R
Rusty Russell 已提交
72 73 74
};
extern struct lguest_data lguest_data;
#endif /* __ASSEMBLY__ */
75
#endif	/* _LINUX_LGUEST_H */