VMMR0.cpp revision 1553bf60f36536439daab34484c0fede780b2e67
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * VMM - Host Context Ring 0.
772269936494ffaddd0750ba9e28e805ba81398cvboxsync * Copyright (C) 2006 InnoTek Systemberatung GmbH
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * available from http://www.virtualbox.org. This file is free software;
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * you can redistribute it and/or modify it under the terms of the GNU
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * General Public License as published by the Free Software Foundation,
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * distribution. VirtualBox OSE is distributed in the hope that it will
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * be useful, but WITHOUT ANY WARRANTY of any kind.
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * If you received this file as part of a commercial VirtualBox
88b7935c7a9d5156b439570abcea19c121ecf60bvboxsync * distribution, then only the terms of your commercial VirtualBox
772269936494ffaddd0750ba9e28e805ba81398cvboxsync * license agreement apply instead of the previous paragraph.
cd8e45740d45f24639c33ae7c61fee5ef2ea856fvboxsync/*******************************************************************************
cd8e45740d45f24639c33ae7c61fee5ef2ea856fvboxsync* Header Files *
cd8e45740d45f24639c33ae7c61fee5ef2ea856fvboxsync*******************************************************************************/
772269936494ffaddd0750ba9e28e805ba81398cvboxsync#ifdef __AMD64__ /** @todo fix logging on __AMD64__ (swapgs) */
#include "VMMInternal.h"
#ifdef DEBUG_NO_RING0_ASSERTIONS
return rc;
if (g_pIntNet)
return VERR_VERSION_MISMATCH;
return VERR_INVALID_PARAMETER;
if (pR0Logger)
LogCom(("VMMR0Init: offScratch=%d fFlags=%#x fDestFlags=%#x\n", pR0Logger->Logger.offScratch, pR0Logger->Logger.fFlags, pR0Logger->Logger.fDestFlags));
LogCom(("VMMR0Init: returned succesfully from direct logger call (2). offScratch=%d\n", pR0Logger->Logger.offScratch));
return rc;
return VINF_SUCCESS;
return rc;
#ifdef VBOX_WITH_STATISTICS
switch (rc)
case VINF_SUCCESS:
case VINF_EM_RAW_INTERRUPT:
case VINF_EM_RAW_GUEST_TRAP:
case VINF_EM_RAW_RING_SWITCH:
case VINF_EM_RAW_IRET_TRAP:
case VINF_IOM_HC_IOPORT_READ:
case VINF_IOM_HC_IOPORT_WRITE:
case VINF_IOM_HC_MMIO_READ:
case VINF_IOM_HC_MMIO_WRITE:
case VINF_PATCH_EMULATE_INSTR:
case VINF_CSAM_PENDING_ACTION:
case VINF_PGM_SYNC_CR3:
case VINF_PATM_PATCH_INT3:
case VINF_PATM_PATCH_TRAP_PF:
case VINF_PATM_PATCH_TRAP_GP:
case VINF_EM_RESCHEDULE_REM:
case VINF_EM_RAW_TO_R3:
case VINF_VMM_CALL_HOST:
case VMMCALLHOST_PDM_LOCK:
case VMMCALLHOST_PGM_LOCK:
case VMMCALLHOST_VM_SET_ERROR:
case VINF_PGM_CHANGE_MODE:
case VINF_EM_PENDING_REQUEST:
switch (uOperation)
case VMMR0_DO_RAW_RUN:
return VERR_NOT_SUPPORTED;
register int rc;
#ifdef VBOX_WITH_STATISTICS
switch (rc)
return rc;
return rc;
case VINF_EM_RAW_INTERRUPT:
#ifdef VBOX_WITHOUT_IDT_PATCHING
# if defined(__GNUC__)
static bool s_fHaveWarned = false;
if (!s_fHaveWarned)
s_fHaveWarned = true;
return rc;
case VMMR0_DO_HWACC_RUN:
int rc;
#ifdef DEBUG_NO_RING0_ASSERTIONS
rc = vmmR0CallHostSetJmp(&pVM->vmm.s.CallHostR0JmpBuf, HWACCMR0RunGuestCode, pVM); /* this may resume code. */
#ifdef DEBUG_NO_RING0_ASSERTIONS
g_pVMAssert = 0;
#ifdef VBOX_WITH_STATISTICS
return rc;
case VMMR0_DO_VMMR0_INIT:
case VMMR0_DO_VMMR0_TERM:
case VMMR0_DO_HWACC_SETUP_VM:
case VMMR0_DO_CALL_HYPERVISOR:
return VERR_NOT_SUPPORTED;
return rc;
#if !defined(__L4__) && !defined(__AMD64__) /** @todo Port this to L4. */ /** @todo fix logging and other services problems on AMD64. */
case VMMR0_DO_INTNET_OPEN:
case VMMR0_DO_INTNET_IF_CLOSE:
case VMMR0_DO_INTNET_IF_SEND:
case VMMR0_DO_INTNET_IF_WAIT:
return VERR_INVALID_POINTER;
return VERR_INVALID_POINTER;
return VERR_INVALID_POINTER;
return VERR_INVALID_POINTER;
if (!g_pIntNet)
switch (uOperation)
case VMMR0_DO_INTNET_OPEN:
return INTNETR0Open(g_pIntNet, pVM->pSession, &pArgs->szNetwork[0], pArgs->cbSend, pArgs->cbRecv, &pArgs->hIf);
case VMMR0_DO_INTNET_IF_CLOSE:
case VMMR0_DO_INTNET_IF_SEND:
case VMMR0_DO_INTNET_IF_WAIT:
return VERR_NOT_SUPPORTED;
case VMMR0_DO_NOP:
return VINF_SUCCESS;
case VMMR0_DO_TESTS:
return VINF_SUCCESS;
return VERR_NOT_SUPPORTED;
#ifdef __X86__
#ifdef DEBUG_NO_RING0_ASSERTIONS
if (g_pVMAssert)
DECLEXPORT(void) RTCALL AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
if (pLog)