VMMR0.cpp revision a05a34f9c8e06e12f7c62b1e85cb28028106a094
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * VMM - Host Context Ring 0.
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * Copyright (C) 2006 InnoTek Systemberatung GmbH
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * This file is part of VirtualBox Open Source Edition (OSE), as
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * available from http://www.virtualbox.org. This file is free software;
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * you can redistribute it and/or modify it under the terms of the GNU
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * General Public License as published by the Free Software Foundation,
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * distribution. VirtualBox OSE is distributed in the hope that it will
7cbae22b7560eefcf086863923459880aa87f014Jaco Jooste * be useful, but WITHOUT ANY WARRANTY of any kind.
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * If you received this file as part of a commercial VirtualBox
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * distribution, then only the terms of your commercial VirtualBox
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell * license agreement apply instead of the previous paragraph.
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell/*******************************************************************************
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell* Header Files *
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell*******************************************************************************/
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell#ifdef __AMD64__ /** @todo fix logging on __AMD64__ (swapgs) */
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell#if defined(_MSC_VER) && defined(__AMD64__) /** @todo check this with with VC7! */
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell/*******************************************************************************
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell* Internal Functions *
aa3a2aee90d1c61946a08c839d9838be7658b453Craig McDonnell*******************************************************************************/
#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:
return rc;
case VMMR0_DO_VMMR0_TERM:
return rc;
case VMMR0_DO_HWACC_SETUP_VM:
return rc;
case VMMR0_DO_CALL_HYPERVISOR:
return VERR_NOT_SUPPORTED;
return rc;
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__
void R0LogFlush()
#ifdef DEBUG_NO_RING0_ASSERTIONS
if (g_pVMAssert)
DECLEXPORT(void) RTCALL AssertMsg1(const char *pszExpr, unsigned uLine, const char *pszFile, const char *pszFunction)
return cbChars;
if (pLog)
R0LogFlush();