blob: 7bc1440fc47305418967134e2f65e0e23ea24572 [file] [log] [blame]
Rusty Russell07ad1572007-07-19 01:49:22 -07001/* Things the lguest guest needs to know. Note: like all lguest interfaces,
2 * this is subject to wild and random change between versions. */
Jes Sorensenc37ae932007-10-22 10:56:26 +10003#ifndef _LINUX_LGUEST_H
4#define _LINUX_LGUEST_H
Rusty Russell07ad1572007-07-19 01:49:22 -07005
Rusty Russell07ad1572007-07-19 01:49:22 -07006#ifndef __ASSEMBLY__
Jes Sorensen47aee452007-10-22 11:03:33 +10007#include <linux/time.h>
Rusty Russell07ad1572007-07-19 01:49:22 -07008#include <asm/irq.h>
Jes Sorensenc37ae932007-10-22 10:56:26 +10009#include <asm/lguest_hcall.h>
Rusty Russell07ad1572007-07-19 01:49:22 -070010
Rusty Russelld7e28ff2007-07-19 01:49:23 -070011#define LG_CLOCK_MIN_DELTA 100UL
12#define LG_CLOCK_MAX_DELTA ULONG_MAX
13
Rusty Russellb2b47c22007-07-26 10:41:02 -070014/*G:032 The second method of communicating with the Host is to via "struct
Rusty Russelle1e72962007-10-25 15:02:50 +100015 * lguest_data". Once the Guest's initialization hypercall tells the Host where
16 * this is, the Guest and Host both publish information in it. :*/
Rusty Russell07ad1572007-07-19 01:49:22 -070017struct lguest_data
18{
Rusty Russellb2b47c22007-07-26 10:41:02 -070019 /* 512 == enabled (same as eflags in normal hardware). The Guest
20 * changes interrupts so often that a hypercall is too slow. */
Rusty Russell07ad1572007-07-19 01:49:22 -070021 unsigned int irq_enabled;
Rusty Russellb2b47c22007-07-26 10:41:02 -070022 /* Fine-grained interrupt disabling by the Guest */
Rusty Russell07ad1572007-07-19 01:49:22 -070023 DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
24
Rusty Russellb2b47c22007-07-26 10:41:02 -070025 /* The Host writes the virtual address of the last page fault here,
26 * which saves the Guest a hypercall. CR2 is the native register where
27 * this address would normally be found. */
Rusty Russell07ad1572007-07-19 01:49:22 -070028 unsigned long cr2;
29
Rusty Russell6c8dca52007-07-27 13:42:52 +100030 /* Wallclock time set by the Host. */
31 struct timespec time;
32
Rusty Russella32a88132009-06-12 22:27:02 -060033 /* Interrupt pending set by the Host. The Guest should do a hypercall
34 * if it re-enables interrupts and sees this set (to X86_EFLAGS_IF). */
35 int irq_pending;
36
Rusty Russellb2b47c22007-07-26 10:41:02 -070037 /* Async hypercall ring. Instead of directly making hypercalls, we can
38 * place them in here for processing the next time the Host wants.
39 * This batching can be quite efficient. */
40
41 /* 0xFF == done (set by Host), 0 == pending (set by Guest). */
Rusty Russell07ad1572007-07-19 01:49:22 -070042 u8 hcall_status[LHCALL_RING_SIZE];
Rusty Russellb2b47c22007-07-26 10:41:02 -070043 /* The actual registers for the hypercalls. */
Jes Sorensenb410e7b2007-10-22 11:03:31 +100044 struct hcall_args hcalls[LHCALL_RING_SIZE];
Rusty Russell07ad1572007-07-19 01:49:22 -070045
Rusty Russellb2b47c22007-07-26 10:41:02 -070046/* Fields initialized by the Host at boot: */
Rusty Russell07ad1572007-07-19 01:49:22 -070047 /* Memory not to try to access */
48 unsigned long reserve_mem;
Rusty Russelld7e28ff2007-07-19 01:49:23 -070049 /* KHz for the TSC clock. */
50 u32 tsc_khz;
Rusty Russell47436aa2007-10-22 11:03:36 +100051 /* Page where the top-level pagetable is */
52 unsigned long pgdir;
Rusty Russell07ad1572007-07-19 01:49:22 -070053
Rusty Russellb2b47c22007-07-26 10:41:02 -070054/* Fields initialized by the Guest at boot: */
Rusty Russell07ad1572007-07-19 01:49:22 -070055 /* Instruction range to suppress interrupts even if enabled */
56 unsigned long noirq_start, noirq_end;
Rusty Russell47436aa2007-10-22 11:03:36 +100057 /* Address above which page tables are all identical. */
58 unsigned long kernel_address;
Rusty Russellc18acd72007-10-22 11:03:35 +100059 /* The vector to try to use for system calls (0x40 or 0x80). */
60 unsigned int syscall_vec;
Rusty Russell07ad1572007-07-19 01:49:22 -070061};
62extern struct lguest_data lguest_data;
63#endif /* __ASSEMBLY__ */
Jes Sorensenc37ae932007-10-22 10:56:26 +100064#endif /* _LINUX_LGUEST_H */