VMM: removes the dune <-> proc Connecting to the proc is the wrong approach for Akaros (the p->virtinfo or whatever). Also removed the dune_config while I was at it.
diff --git a/kern/arch/x86/vmm/intel/compat.h b/kern/arch/x86/vmm/intel/compat.h index 6f5699f..8750c3a 100644 --- a/kern/arch/x86/vmm/intel/compat.h +++ b/kern/arch/x86/vmm/intel/compat.h
@@ -18,15 +18,6 @@ #define SECONDARY_EXEC_ENABLE_INVPCID 0x00001000 #endif -// put this somewhere, someday. - -struct dune_config { - uint64_t rip; - uint64_t rsp; - uint64_t cr3; - uint64_t flags; -}; - /* * shutdown reasons */
diff --git a/kern/arch/x86/vmm/intel/vmx.c b/kern/arch/x86/vmm/intel/vmx.c index 8efa0b2..1d43c5d 100644 --- a/kern/arch/x86/vmm/intel/vmx.c +++ b/kern/arch/x86/vmm/intel/vmx.c
@@ -1229,29 +1229,18 @@ } /** - * vmx_task_vcpu - returns a pointer to the task's vcpu or NULL. - * @task: the task - */ -static inline struct vmx_vcpu *vmx_task_vcpu(struct proc *p) -{ - struct dune_struct *dune = current->virtinfo; - return dune ? dune->vcpu : NULL; -} - -/** * vmx_current_vcpu - returns a pointer to the vcpu for the current task. * * In the contexts where this is used the vcpu pointer should never be NULL. */ static inline struct vmx_vcpu *vmx_current_vcpu(void) { - struct vmx_vcpu *vcpu = vmx_task_vcpu(current); - if (! vcpu) - panic("%s: core_id %d: no vcpu", __func__, core_id()); + struct vmx_vcpu *vcpu = currentcpu->local_vcpu; + if (!vcpu) + panic("Core has no vcpu!"); return vcpu; } - /** * vmx_run_vcpu - launches the CPU into non-root mode * We ONLY support 64-bit guests. @@ -1473,20 +1462,16 @@ * vmx_launch - the main loop for a VMX Dune process * @conf: the launch configuration */ -int vmx_launch(struct dune_config *conf) +int vmx_launch(uint64_t rip, uint64_t rsp, uint64_t cr3) { int ret; - struct dune_struct dune; struct vmx_vcpu *vcpu; int i = 0; - unsigned long rip = conf->rip; - unsigned long rsp = conf->rsp; - unsigned long cr3 = conf->cr3; int errors = 0; - if (conf->rip < 4096 ) { + if (rip < 4096 ) { // testing. - switch(conf->rip) { + switch(rip) { default: rip = (uint64_t)noop + 4; break; @@ -1496,7 +1481,7 @@ } } - if (conf->cr3 == 0) { + if (cr3 == 0) { cr3 = rcr3(); } @@ -1534,13 +1519,6 @@ vcpu->ret_code = -1; - if (current->virtinfo) - printk("vmx_launch: current->virtinfo is NOT NULL (%p)\n", current->virtinfo); - //WARN_ON(current->virtinfo != NULL); - dune.vcpu = vcpu; - - current->virtinfo = &dune; - while (1) { vmx_get_cpu(vcpu); @@ -1582,7 +1560,6 @@ printk("RETURN. ip %016lx sp %016lx\n", vcpu->regs.tf_rip, vcpu->regs.tf_rsp); - current->virtinfo = NULL; /* * Return both the reason for the shutdown and a status value.
diff --git a/kern/arch/x86/vmm/intel/vmx.h b/kern/arch/x86/vmm/intel/vmx.h index abd4c12..ec7ceb3 100644 --- a/kern/arch/x86/vmm/intel/vmx.h +++ b/kern/arch/x86/vmm/intel/vmx.h
@@ -608,10 +608,6 @@ uint32_t zero1; } __attribute__((packed)); -struct dune_struct { - struct vmx_vcpu *vcpu; -}; - struct vmx_vcpu { int cpu;
diff --git a/kern/arch/x86/vmm/vmm.c b/kern/arch/x86/vmm/vmm.c index be52e53..032a496 100644 --- a/kern/arch/x86/vmm/vmm.c +++ b/kern/arch/x86/vmm/vmm.c
@@ -59,12 +59,11 @@ int vm_run(uint64_t rip, uint64_t rsp, uint64_t cr3) { - struct dune_config d = {rip, rsp, cr3}; - int vmx_launch(struct dune_config *conf); + int vmx_launch(uint64_t rip, uint64_t rsp, uint64_t cr3); if (current->vmm.amd) { return -1; } else { - return vmx_launch(&d); + return vmx_launch(rip, rsp, cr3); } return -1; }
diff --git a/kern/include/env.h b/kern/include/env.h index 37ed4ad..49dac63 100644 --- a/kern/include/env.h +++ b/kern/include/env.h
@@ -103,7 +103,6 @@ struct proc_alarm_set alarmset; struct cv_lookup_tailq abortable_sleepers; spinlock_t abort_list_lock; - void *virtinfo; /* VMMCP */ struct vmm vmm;