lguest_launcher.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #ifndef _LINUX_LGUEST_LAUNCHER
  2. #define _LINUX_LGUEST_LAUNCHER
  3. /* Everything the "lguest" userspace program needs to know. */
  4. #include <linux/types.h>
  5. /*D:010
  6. * Drivers
  7. *
  8. * The Guest needs devices to do anything useful. Since we don't let it touch
  9. * real devices (think of the damage it could do!) we provide virtual devices.
  10. * We emulate a PCI bus with virtio devices on it; we used to have our own
  11. * lguest bus which was far simpler, but this tests the virtio 1.0 standard.
  12. *
  13. * Virtio devices are also used by kvm, so we can simply reuse their optimized
  14. * device drivers. And one day when everyone uses virtio, my plan will be
  15. * complete. Bwahahahah!
  16. */
  17. /* Write command first word is a request. */
  18. enum lguest_req
  19. {
  20. LHREQ_INITIALIZE, /* + base, pfnlimit, start */
  21. LHREQ_GETDMA, /* No longer used */
  22. LHREQ_IRQ, /* + irq */
  23. LHREQ_BREAK, /* No longer used */
  24. LHREQ_EVENTFD, /* No longer used. */
  25. LHREQ_GETREG, /* + offset within struct pt_regs (then read value). */
  26. LHREQ_SETREG, /* + offset within struct pt_regs, value. */
  27. LHREQ_TRAP, /* + trap number to deliver to guest. */
  28. };
  29. /*
  30. * This is what read() of the lguest fd populates. trap ==
  31. * LGUEST_TRAP_ENTRY for an LHCALL_NOTIFY (addr is the
  32. * argument), 14 for a page fault in the MMIO region (addr is
  33. * the trap address, insn is the instruction), or 13 for a GPF
  34. * (insn is the instruction).
  35. */
  36. struct lguest_pending {
  37. __u8 trap;
  38. __u8 insn[7];
  39. __u32 addr;
  40. };
  41. #endif /* _LINUX_LGUEST_LAUNCHER */