lguest.h 2.2 KB

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