lguest.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. /* Things the lguest guest needs to know. Note: like all lguest interfaces,
  2. * this is subject to wild and random change between versions. */
  3. #ifndef _LINUX_LGUEST_H
  4. #define _LINUX_LGUEST_H
  5. #ifndef __ASSEMBLY__
  6. #include <linux/time.h>
  7. #include <asm/irq.h>
  8. #include <asm/lguest_hcall.h>
  9. #define LG_CLOCK_MIN_DELTA 100UL
  10. #define LG_CLOCK_MAX_DELTA ULONG_MAX
  11. /*G:031 The second method of communicating with the Host is to via "struct
  12. * lguest_data". Once the Guest's initialization hypercall tells the Host where
  13. * this is, the Guest and Host both publish information in it. :*/
  14. struct lguest_data
  15. {
  16. /* 512 == enabled (same as eflags in normal hardware). The Guest
  17. * changes interrupts so often that a hypercall is too slow. */
  18. unsigned int irq_enabled;
  19. /* Fine-grained interrupt disabling by the Guest */
  20. DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
  21. /* The Host writes the virtual address of the last page fault here,
  22. * which saves the Guest a hypercall. CR2 is the native register where
  23. * this address would normally be found. */
  24. unsigned long cr2;
  25. /* Wallclock time set by the Host. */
  26. struct timespec time;
  27. /* Interrupt pending set by the Host. The Guest should do a hypercall
  28. * if it re-enables interrupts and sees this set (to X86_EFLAGS_IF). */
  29. int irq_pending;
  30. /* Async hypercall ring. Instead of directly making hypercalls, we can
  31. * place them in here for processing the next time the Host wants.
  32. * This batching can be quite efficient. */
  33. /* 0xFF == done (set by Host), 0 == pending (set by Guest). */
  34. u8 hcall_status[LHCALL_RING_SIZE];
  35. /* The actual registers for the hypercalls. */
  36. struct hcall_args hcalls[LHCALL_RING_SIZE];
  37. /* Fields initialized by the Host at boot: */
  38. /* Memory not to try to access */
  39. unsigned long reserve_mem;
  40. /* KHz for the TSC clock. */
  41. u32 tsc_khz;
  42. /* Page where the top-level pagetable is */
  43. unsigned long pgdir;
  44. /* Fields initialized by the Guest at boot: */
  45. /* Instruction range to suppress interrupts even if enabled */
  46. unsigned long noirq_start, noirq_end;
  47. /* Address above which page tables are all identical. */
  48. unsigned long kernel_address;
  49. /* The vector to try to use for system calls (0x40 or 0x80). */
  50. unsigned int syscall_vec;
  51. };
  52. extern struct lguest_data lguest_data;
  53. #endif /* __ASSEMBLY__ */
  54. #endif /* _LINUX_LGUEST_H */