blob: 175e63f4a8c08d90de05b5a41382c60e8ffcabba [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 Russellb2b47c22007-07-26 10:41:02 -070033 /* Async hypercall ring. Instead of directly making hypercalls, we can
34 * place them in here for processing the next time the Host wants.
35 * This batching can be quite efficient. */
36
37 /* 0xFF == done (set by Host), 0 == pending (set by Guest). */
Rusty Russell07ad1572007-07-19 01:49:22 -070038 u8 hcall_status[LHCALL_RING_SIZE];
Rusty Russellb2b47c22007-07-26 10:41:02 -070039 /* The actual registers for the hypercalls. */
Jes Sorensenb410e7b2007-10-22 11:03:31 +100040 struct hcall_args hcalls[LHCALL_RING_SIZE];
Rusty Russell07ad1572007-07-19 01:49:22 -070041
Rusty Russellb2b47c22007-07-26 10:41:02 -070042/* Fields initialized by the Host at boot: */
Rusty Russell07ad1572007-07-19 01:49:22 -070043 /* Memory not to try to access */
44 unsigned long reserve_mem;
Rusty Russelld7e28ff2007-07-19 01:49:23 -070045 /* KHz for the TSC clock. */
46 u32 tsc_khz;
Rusty Russell47436aa2007-10-22 11:03:36 +100047 /* Page where the top-level pagetable is */
48 unsigned long pgdir;
Rusty Russell07ad1572007-07-19 01:49:22 -070049
Rusty Russellb2b47c22007-07-26 10:41:02 -070050/* Fields initialized by the Guest at boot: */
Rusty Russell07ad1572007-07-19 01:49:22 -070051 /* Instruction range to suppress interrupts even if enabled */
52 unsigned long noirq_start, noirq_end;
Rusty Russell47436aa2007-10-22 11:03:36 +100053 /* Address above which page tables are all identical. */
54 unsigned long kernel_address;
Rusty Russellc18acd72007-10-22 11:03:35 +100055 /* The vector to try to use for system calls (0x40 or 0x80). */
56 unsigned int syscall_vec;
Rusty Russell07ad1572007-07-19 01:49:22 -070057};
58extern struct lguest_data lguest_data;
59#endif /* __ASSEMBLY__ */
Jes Sorensenc37ae932007-10-22 10:56:26 +100060#endif /* _LINUX_LGUEST_H */