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