| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 1 | /* Things the lguest guest needs to know.  Note: like all lguest interfaces, | 
 | 2 |  * this is subject to wild and random change between versions. */ | 
| Jes Sorensen | c37ae93 | 2007-10-22 10:56:26 +1000 | [diff] [blame] | 3 | #ifndef _LINUX_LGUEST_H | 
 | 4 | #define _LINUX_LGUEST_H | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 5 |  | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 6 | #ifndef __ASSEMBLY__ | 
| Jes Sorensen | 47aee45 | 2007-10-22 11:03:33 +1000 | [diff] [blame] | 7 | #include <linux/time.h> | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 8 | #include <asm/irq.h> | 
| Jes Sorensen | c37ae93 | 2007-10-22 10:56:26 +1000 | [diff] [blame] | 9 | #include <asm/lguest_hcall.h> | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 10 |  | 
| Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 11 | #define LG_CLOCK_MIN_DELTA	100UL | 
 | 12 | #define LG_CLOCK_MAX_DELTA	ULONG_MAX | 
 | 13 |  | 
| Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 14 | /*G:032 The second method of communicating with the Host is to via "struct | 
| Rusty Russell | e1e7296 | 2007-10-25 15:02:50 +1000 | [diff] [blame] | 15 |  * 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 Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 17 | struct lguest_data | 
 | 18 | { | 
| Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 19 | 	/* 512 == enabled (same as eflags in normal hardware).  The Guest | 
 | 20 | 	 * changes interrupts so often that a hypercall is too slow. */ | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 21 | 	unsigned int irq_enabled; | 
| Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 22 | 	/* Fine-grained interrupt disabling by the Guest */ | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 23 | 	DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS); | 
 | 24 |  | 
| Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 25 | 	/* 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 Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 28 | 	unsigned long cr2; | 
 | 29 |  | 
| Rusty Russell | 6c8dca5 | 2007-07-27 13:42:52 +1000 | [diff] [blame] | 30 | 	/* Wallclock time set by the Host. */ | 
 | 31 | 	struct timespec time; | 
 | 32 |  | 
| Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 33 | 	/* 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 Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 38 | 	u8 hcall_status[LHCALL_RING_SIZE]; | 
| Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 39 | 	/* The actual registers for the hypercalls. */ | 
| Jes Sorensen | b410e7b | 2007-10-22 11:03:31 +1000 | [diff] [blame] | 40 | 	struct hcall_args hcalls[LHCALL_RING_SIZE]; | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 41 |  | 
| Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 42 | /* Fields initialized by the Host at boot: */ | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 43 | 	/* Memory not to try to access */ | 
 | 44 | 	unsigned long reserve_mem; | 
| Rusty Russell | d7e28ff | 2007-07-19 01:49:23 -0700 | [diff] [blame] | 45 | 	/* KHz for the TSC clock. */ | 
 | 46 | 	u32 tsc_khz; | 
| Rusty Russell | 47436aa | 2007-10-22 11:03:36 +1000 | [diff] [blame] | 47 | 	/* Page where the top-level pagetable is */ | 
 | 48 | 	unsigned long pgdir; | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 49 |  | 
| Rusty Russell | b2b47c2 | 2007-07-26 10:41:02 -0700 | [diff] [blame] | 50 | /* Fields initialized by the Guest at boot: */ | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 51 | 	/* Instruction range to suppress interrupts even if enabled */ | 
 | 52 | 	unsigned long noirq_start, noirq_end; | 
| Rusty Russell | 47436aa | 2007-10-22 11:03:36 +1000 | [diff] [blame] | 53 | 	/* Address above which page tables are all identical. */ | 
 | 54 | 	unsigned long kernel_address; | 
| Rusty Russell | c18acd7 | 2007-10-22 11:03:35 +1000 | [diff] [blame] | 55 | 	/* The vector to try to use for system calls (0x40 or 0x80). */ | 
 | 56 | 	unsigned int syscall_vec; | 
| Rusty Russell | 07ad157 | 2007-07-19 01:49:22 -0700 | [diff] [blame] | 57 | }; | 
 | 58 | extern struct lguest_data lguest_data; | 
 | 59 | #endif /* __ASSEMBLY__ */ | 
| Jes Sorensen | c37ae93 | 2007-10-22 10:56:26 +1000 | [diff] [blame] | 60 | #endif	/* _LINUX_LGUEST_H */ |