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.
:*/
R
Rusty Russell 已提交
21 22
struct lguest_data
{
R
Rusty Russell 已提交
23 24 25 26
	/*
	 * 512 == enabled (same as eflags in normal hardware).  The Guest
	 * changes interrupts so often that a hypercall is too slow.
	 */
R
Rusty Russell 已提交
27
	unsigned int irq_enabled;
R
Rusty Russell 已提交
28
	/* Fine-grained interrupt disabling by the Guest */
R
Rusty Russell 已提交
29 30
	DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);

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

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

R
Rusty Russell 已提交
41 42 43 44
	/*
	 * 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).
	 */
45 46
	int irq_pending;

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

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

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

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