Blame view

include/linux/lguest.h 2.24 KB
2e04ef769   Rusty Russell   lguest: fix comme...
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.
   */
c37ae93d5   Jes Sorensen   Move lguest hcall...
5
6
  #ifndef _LINUX_LGUEST_H
  #define _LINUX_LGUEST_H
07ad157f6   Rusty Russell   lguest: the guest...
7

07ad157f6   Rusty Russell   lguest: the guest...
8
  #ifndef __ASSEMBLY__
47aee45ae   Jes Sorensen   lguest.h declares...
9
  #include <linux/time.h>
07ad157f6   Rusty Russell   lguest: the guest...
10
  #include <asm/irq.h>
c37ae93d5   Jes Sorensen   Move lguest hcall...
11
  #include <asm/lguest_hcall.h>
07ad157f6   Rusty Russell   lguest: the guest...
12

d7e28ffe6   Rusty Russell   lguest: the host ...
13
14
  #define LG_CLOCK_MIN_DELTA	100UL
  #define LG_CLOCK_MAX_DELTA	ULONG_MAX
2e04ef769   Rusty Russell   lguest: fix comme...
15
16
  /*G:031
   * The second method of communicating with the Host is to via "struct
e1e72965e   Rusty Russell   lguest: documenta...
17
   * lguest_data".  Once the Guest's initialization hypercall tells the Host where
2e04ef769   Rusty Russell   lguest: fix comme...
18
19
   * this is, the Guest and Host both publish information in it.
  :*/
1842f23c0   Rusty Russell   lguest and virtio...
20
  struct lguest_data {
2e04ef769   Rusty Russell   lguest: fix comme...
21
22
23
24
  	/*
  	 * 512 == enabled (same as eflags in normal hardware).  The Guest
  	 * changes interrupts so often that a hypercall is too slow.
  	 */
07ad157f6   Rusty Russell   lguest: the guest...
25
  	unsigned int irq_enabled;
b2b47c214   Rusty Russell   lguest: documenta...
26
  	/* Fine-grained interrupt disabling by the Guest */
07ad157f6   Rusty Russell   lguest: the guest...
27
  	DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
2e04ef769   Rusty Russell   lguest: fix comme...
28
29
  	/*
  	 * The Host writes the virtual address of the last page fault here,
b2b47c214   Rusty Russell   lguest: documenta...
30
  	 * which saves the Guest a hypercall.  CR2 is the native register where
2e04ef769   Rusty Russell   lguest: fix comme...
31
32
  	 * this address would normally be found.
  	 */
07ad157f6   Rusty Russell   lguest: the guest...
33
  	unsigned long cr2;
6c8dca5d5   Rusty Russell   Provide timespec ...
34
35
  	/* Wallclock time set by the Host. */
  	struct timespec time;
2e04ef769   Rusty Russell   lguest: fix comme...
36
37
38
39
  	/*
  	 * 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).
  	 */
a32a8813d   Rusty Russell   lguest: improve i...
40
  	int irq_pending;
2e04ef769   Rusty Russell   lguest: fix comme...
41
42
  	/*
  	 * Async hypercall ring.  Instead of directly making hypercalls, we can
b2b47c214   Rusty Russell   lguest: documenta...
43
  	 * place them in here for processing the next time the Host wants.
2e04ef769   Rusty Russell   lguest: fix comme...
44
45
  	 * This batching can be quite efficient.
  	 */
b2b47c214   Rusty Russell   lguest: documenta...
46
47
  
  	/* 0xFF == done (set by Host), 0 == pending (set by Guest). */
07ad157f6   Rusty Russell   lguest: the guest...
48
  	u8 hcall_status[LHCALL_RING_SIZE];
b2b47c214   Rusty Russell   lguest: documenta...
49
  	/* The actual registers for the hypercalls. */
b410e7b14   Jes Sorensen   Make hypercalls a...
50
  	struct hcall_args hcalls[LHCALL_RING_SIZE];
07ad157f6   Rusty Russell   lguest: the guest...
51

b2b47c214   Rusty Russell   lguest: documenta...
52
  /* Fields initialized by the Host at boot: */
07ad157f6   Rusty Russell   lguest: the guest...
53
54
  	/* Memory not to try to access */
  	unsigned long reserve_mem;
d7e28ffe6   Rusty Russell   lguest: the host ...
55
56
  	/* KHz for the TSC clock. */
  	u32 tsc_khz;
07ad157f6   Rusty Russell   lguest: the guest...
57

b2b47c214   Rusty Russell   lguest: documenta...
58
  /* Fields initialized by the Guest at boot: */
07ad157f6   Rusty Russell   lguest: the guest...
59
60
  	/* Instruction range to suppress interrupts even if enabled */
  	unsigned long noirq_start, noirq_end;
47436aa4a   Rusty Russell   Boot with virtual...
61
62
  	/* Address above which page tables are all identical. */
  	unsigned long kernel_address;
c18acd73f   Rusty Russell   Allow guest to sp...
63
64
  	/* The vector to try to use for system calls (0x40 or 0x80). */
  	unsigned int syscall_vec;
07ad157f6   Rusty Russell   lguest: the guest...
65
66
67
  };
  extern struct lguest_data lguest_data;
  #endif /* __ASSEMBLY__ */
c37ae93d5   Jes Sorensen   Move lguest hcall...
68
  #endif	/* _LINUX_LGUEST_H */