VMM: Remove the stack
[akaros.git] / user / vmm / include / vmm / vmm.h
1 /* Copyright (c) 2015 Google Inc.
2  * Ron Minnich <rminnich@google.com>
3  * See LICENSE for details.
4  *
5  * VMM.h */
6
7 #pragma once
8
9 #include <ros/vmm.h>
10 #include <vmm/sched.h>
11
12 /* Structure to encapsulate all of the bookkeeping for a VM. */
13 struct virtual_machine {
14         struct guest_thread                     **gths;
15         unsigned int                            nr_gpcs;
16         struct vmm_gpcore_init          *gpcis;
17
18         /* TODO: put these in appropriate structures.  e.g., virtio things in
19          * something related to virtio.  low4k in something related to the guest's
20          * memory. */
21         uintptr_t                                       virtio_mmio_base;
22         int                                                     virtio_irq;
23         uint8_t                                         *low4k;
24 };
25
26 char *regname(uint8_t reg);
27 int decode(struct guest_thread *vm_thread, uint64_t *gpa, uint8_t *destreg,
28            uint64_t **regp, int *store, int *size, int *advance);
29 int io(struct guest_thread *vm_thread);
30 void showstatus(FILE *f, struct guest_thread *vm_thread);
31 int msrio(struct guest_thread *vm_thread, struct vmm_gpcore_init *gpci,
32           uint32_t opcode);
33 int do_ioapic(struct guest_thread *vm_thread, uint64_t gpa,
34               int destreg, uint64_t *regp, int store);
35
36 /* Lookup helpers */
37
38 static struct virtual_machine *gth_to_vm(struct guest_thread *gth)
39 {
40         /* TODO */
41         return 0;
42 }