Sanitize vcoreid from untrusted sources
[akaros.git] / kern / include / ros / vmm.h
index 40ce423..fc0ac44 100644 (file)
@@ -8,35 +8,21 @@
 
 #include <ros/arch/vmm.h>
 
-#define        VMM_VMCALL_PRINTF       0x1     /* Enable VMCALL output console hack */
+/* VMCALL FUNCTION NUMBERS */
+#define VMCALL_PRINTC          0x1
+#define VMCALL_SMPBOOT         0x2
+#define VMCALL_GET_TSCFREQ     0x3
+#define VMCALL_TRACE_TF                0x4
 
-#define VMM_ALL_FLAGS  (VMM_VMCALL_PRINTF)
+#define VMM_CTL_GET_EXITS              1
+#define VMM_CTL_SET_EXITS              2
+#define VMM_CTL_GET_FLAGS              3
+#define VMM_CTL_SET_FLAGS              4
 
-enum {
-       RESUME,
-       REG_RSP_RIP_CR3,
-       REG_RIP,
-       REG_ALL,
-};
+#define VMM_CTL_EXIT_HALT              (1 << 0)
+#define VMM_CTL_EXIT_PAUSE             (1 << 1)
+#define VMM_CTL_EXIT_MWAIT             (1 << 2)
+#define VMM_CTL_ALL_EXITS              ((1 << 3) - 1)
 
-/* eventually, this is a system call. For now, it's #c/vmctl.
- * You fill in the blanks, and write the struct to #c/vmctl.
- * On return, i.e. vmexit, it's updated with the new values.
- */
-struct vmctl {
-       uint64_t command;
-       uint64_t cr3;
-       uint64_t gva;
-       uint64_t gpa;
-       uint64_t exit_qual;
-       uint64_t shutdown;
-       uint64_t ret_code;
-       uint64_t core;
-       uint32_t interrupt;
-       uint32_t intrinfo1;
-       uint32_t intrinfo2;
-       // These two page-sized entities must be page-aligned
-       uint64_t pir;
-       uint64_t vapic;
-       struct hw_trapframe regs;
-};
+#define VMM_CTL_FL_KERN_PRINTC         (1 << 0)
+#define VMM_CTL_ALL_FLAGS              (VMM_CTL_FL_KERN_PRINTC)