| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  | /*
 | 
					
						
							|  |  |  |  * Things the lguest guest needs to know.  Note: like all lguest interfaces, | 
					
						
							|  |  |  |  * this is subject to wild and random change between versions. | 
					
						
							|  |  |  |  */ | 
					
						
							| 
									
										
										
										
											2007-10-22 10:56:26 +10:00
										 |  |  | #ifndef _LINUX_LGUEST_H
 | 
					
						
							|  |  |  | #define _LINUX_LGUEST_H
 | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | #ifndef __ASSEMBLY__
 | 
					
						
							| 
									
										
										
										
											2007-10-22 11:03:33 +10:00
										 |  |  | #include <linux/time.h>
 | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | #include <asm/irq.h>
 | 
					
						
							| 
									
										
										
										
											2007-10-22 10:56:26 +10:00
										 |  |  | #include <asm/lguest_hcall.h>
 | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:23 -07:00
										 |  |  | #define LG_CLOCK_MIN_DELTA	100UL
 | 
					
						
							|  |  |  | #define LG_CLOCK_MAX_DELTA	ULONG_MAX
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  | /*G:031
 | 
					
						
							|  |  |  |  * The second method of communicating with the Host is to via "struct | 
					
						
							| 
									
										
										
										
											2007-10-25 15:02:50 +10:00
										 |  |  |  * lguest_data".  Once the Guest's initialization hypercall tells the Host where | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  |  * this is, the Guest and Host both publish information in it. | 
					
						
							|  |  |  | :*/ | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:46 -06:00
										 |  |  | struct lguest_data { | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * 512 == enabled (same as eflags in normal hardware).  The Guest | 
					
						
							|  |  |  | 	 * changes interrupts so often that a hypercall is too slow. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 	unsigned int irq_enabled; | 
					
						
							| 
									
										
										
										
											2007-07-26 10:41:02 -07:00
										 |  |  | 	/* Fine-grained interrupt disabling by the Guest */ | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 	DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * The Host writes the virtual address of the last page fault here, | 
					
						
							| 
									
										
										
										
											2007-07-26 10:41:02 -07:00
										 |  |  | 	 * which saves the Guest a hypercall.  CR2 is the native register where | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  | 	 * this address would normally be found. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 	unsigned long cr2; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-27 13:42:52 +10:00
										 |  |  | 	/* Wallclock time set by the Host. */ | 
					
						
							|  |  |  | 	struct timespec time; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * 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). | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2009-06-12 22:27:02 -06:00
										 |  |  | 	int irq_pending; | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  | 	/*
 | 
					
						
							|  |  |  | 	 * Async hypercall ring.  Instead of directly making hypercalls, we can | 
					
						
							| 
									
										
										
										
											2007-07-26 10:41:02 -07:00
										 |  |  | 	 * place them in here for processing the next time the Host wants. | 
					
						
							| 
									
										
										
										
											2009-07-30 16:03:45 -06:00
										 |  |  | 	 * This batching can be quite efficient. | 
					
						
							|  |  |  | 	 */ | 
					
						
							| 
									
										
										
										
											2007-07-26 10:41:02 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	/* 0xFF == done (set by Host), 0 == pending (set by Guest). */ | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 	u8 hcall_status[LHCALL_RING_SIZE]; | 
					
						
							| 
									
										
										
										
											2007-07-26 10:41:02 -07:00
										 |  |  | 	/* The actual registers for the hypercalls. */ | 
					
						
							| 
									
										
										
										
											2007-10-22 11:03:31 +10:00
										 |  |  | 	struct hcall_args hcalls[LHCALL_RING_SIZE]; | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-26 10:41:02 -07:00
										 |  |  | /* Fields initialized by the Host at boot: */ | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 	/* Memory not to try to access */ | 
					
						
							|  |  |  | 	unsigned long reserve_mem; | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:23 -07:00
										 |  |  | 	/* KHz for the TSC clock. */ | 
					
						
							|  |  |  | 	u32 tsc_khz; | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2007-07-26 10:41:02 -07:00
										 |  |  | /* Fields initialized by the Guest at boot: */ | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | 	/* Instruction range to suppress interrupts even if enabled */ | 
					
						
							|  |  |  | 	unsigned long noirq_start, noirq_end; | 
					
						
							| 
									
										
										
										
											2007-10-22 11:03:36 +10:00
										 |  |  | 	/* Address above which page tables are all identical. */ | 
					
						
							|  |  |  | 	unsigned long kernel_address; | 
					
						
							| 
									
										
										
										
											2007-10-22 11:03:35 +10:00
										 |  |  | 	/* The vector to try to use for system calls (0x40 or 0x80). */ | 
					
						
							|  |  |  | 	unsigned int syscall_vec; | 
					
						
							| 
									
										
										
										
											2007-07-19 01:49:22 -07:00
										 |  |  | }; | 
					
						
							|  |  |  | extern struct lguest_data lguest_data; | 
					
						
							|  |  |  | #endif /* __ASSEMBLY__ */
 | 
					
						
							| 
									
										
										
										
											2007-10-22 10:56:26 +10:00
										 |  |  | #endif	/* _LINUX_LGUEST_H */
 |