111 lines
2.3 KiB
C++
111 lines
2.3 KiB
C++
/*
|
|
* \brief Genode specific VirtualBox SUPLib supplements.
|
|
* File used by Genode platforms not supporting hardware
|
|
* virtualisation features.
|
|
* \author Alexander Boettcher
|
|
* \date 2013-11-18
|
|
*/
|
|
|
|
/*
|
|
* Copyright (C) 2013 Genode Labs GmbH
|
|
*
|
|
* This file is distributed under the terms of the GNU General Public License
|
|
* version 2.
|
|
*/
|
|
|
|
/* Genode includes */
|
|
#include <base/printf.h>
|
|
#include <base/semaphore.h>
|
|
|
|
/* VirtualBox includes */
|
|
#include <VBox/vmm/vm.h>
|
|
#include <VBox/err.h>
|
|
|
|
/* Genode's VirtualBox includes */
|
|
#include "sup.h"
|
|
#include "vmm_memory.h"
|
|
|
|
/* Libc include */
|
|
#include <pthread.h>
|
|
|
|
/* VirtualBox SUPLib interface */
|
|
|
|
int SUPR3QueryVTxSupported(void)
|
|
{
|
|
return VERR_INTERNAL_ERROR;
|
|
}
|
|
|
|
int SUPR3CallVMMR0Fast(PVMR0 pVMR0, unsigned uOperation, VMCPUID idCpu)
|
|
{
|
|
return VERR_INTERNAL_ERROR;
|
|
}
|
|
|
|
|
|
static Genode::Semaphore *r0_halt_sem()
|
|
{
|
|
static Genode::Semaphore sem;
|
|
return &sem;
|
|
}
|
|
|
|
|
|
int SUPR3CallVMMR0Ex(PVMR0 pVMR0, VMCPUID idCpu, unsigned
|
|
uOperation, uint64_t u64Arg, PSUPVMMR0REQHDR pReqHdr)
|
|
{
|
|
switch(uOperation)
|
|
{
|
|
case VMMR0_DO_GVMM_CREATE_VM:
|
|
genode_VMMR0_DO_GVMM_CREATE_VM(pReqHdr);
|
|
return VINF_SUCCESS;
|
|
|
|
case VMMR0_DO_GVMM_SCHED_HALT:
|
|
r0_halt_sem()->down();
|
|
return VINF_SUCCESS;
|
|
|
|
case VMMR0_DO_GVMM_SCHED_WAKE_UP:
|
|
r0_halt_sem()->up();
|
|
return VINF_SUCCESS;
|
|
|
|
case VMMR0_DO_VMMR0_INIT:
|
|
return VINF_SUCCESS;
|
|
|
|
case VMMR0_DO_GVMM_SCHED_POLL:
|
|
/* called by 'vmR3HaltGlobal1Halt' */
|
|
PDBG("SUPR3CallVMMR0Ex: VMMR0_DO_GVMM_SCHED_POLL");
|
|
return VINF_SUCCESS;
|
|
|
|
default:
|
|
PERR("SUPR3CallVMMR0Ex: unhandled uOperation %d", uOperation);
|
|
return VERR_GENERAL_FAILURE;
|
|
}
|
|
}
|
|
|
|
|
|
bool create_emt_vcpu(pthread_t * thread, size_t stack_size,
|
|
const pthread_attr_t *attr,
|
|
void *(*start_routine)(void *), void *arg,
|
|
Genode::Cpu_session * cpu_session,
|
|
Genode::Affinity::Location location)
|
|
{
|
|
/* no hardware acceleration support */
|
|
return false;
|
|
}
|
|
|
|
|
|
/**
|
|
* Dummies and unimplemented stuff.
|
|
*/
|
|
|
|
uint64_t genode_cpu_hz() {
|
|
return 1000000000ULL; /* XXX fixed 1GHz return value */
|
|
}
|
|
|
|
|
|
bool Vmm_memory::unmap_from_vm(RTGCPHYS GCPhys)
|
|
{
|
|
PWRN("%s unimplemented", __func__);
|
|
return false;
|
|
}
|
|
|
|
|
|
extern "C" void pthread_yield() { PWRN("%s unimplemented", __func__); }
|