REMInternal.h revision ac396e25c413b9c9b382ba32667bc85d7bd51154
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/* $Id$ */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/** @file
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * REM - Internal header file.
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/*
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync *
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * This file is part of VirtualBox Open Source Edition (OSE), as
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * available from http://www.virtualbox.org. This file is free software;
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * you can redistribute it and/or modify it under the terms of the GNU
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * General Public License (GPL) as published by the Free Software
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * Foundation, in version 2 as it comes in the "COPYING" file of the
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync *
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * Clara, CA 95054 USA or visit http://www.sun.com if you need
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * additional information or have any questions.
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#ifndef ___REMInternal_h
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#define ___REMInternal_h
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#include <VBox/cdefs.h>
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#include <VBox/types.h>
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#include <VBox/cpum.h>
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#include <VBox/stam.h>
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#include <VBox/pgm.h>
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#include <VBox/pdmcritsect.h>
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#ifdef REM_INCLUDE_CPU_H
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync# include "target-i386/cpu.h"
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#endif
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/** @defgroup grp_rem_int Internals
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * @ingroup grp_rem
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * @internal
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * @{
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/** The saved state version number. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#define REM_SAVED_STATE_VERSION_VER1_6 6
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#define REM_SAVED_STATE_VERSION 7
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/** @def REM_MONITOR_CODE_PAGES
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * Enable to monitor code pages that have been translated by the recompiler. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/** Currently broken and interferes with CSAM monitoring (see #2784) */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync////#define REM_MONITOR_CODE_PAGES
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#ifdef DOXYGEN_RUNNING
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync# define REM_MONITOR_CODE_PAGES
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#endif
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsynctypedef enum REMHANDLERNOTIFICATIONKIND
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync{
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** The usual invalid 0 entry. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync REMHANDLERNOTIFICATIONKIND_INVALID = 0,
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** REMR3NotifyHandlerPhysicalRegister. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync REMHANDLERNOTIFICATIONKIND_PHYSICAL_REGISTER,
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** REMR3NotifyHandlerPhysicalDeregister. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync REMHANDLERNOTIFICATIONKIND_PHYSICAL_DEREGISTER,
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** REMR3NotifyHandlerPhysicalModify. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync REMHANDLERNOTIFICATIONKIND_PHYSICAL_MODIFY,
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** The usual 32-bit hack. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync REMHANDLERNOTIFICATIONKIND_32BIT_HACK = 0x7fffffff
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync} REMHANDLERNOTIFICATIONKIND;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/**
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * A recorded handler notificiation.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsynctypedef struct REMHANDLERNOTIFICATION
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync{
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** The notification kind. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync REMHANDLERNOTIFICATIONKIND enmKind;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t padding;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Type specific data. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync union
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync {
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync struct
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync {
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPHYS GCPhys;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPHYS cb;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync PGMPHYSHANDLERTYPE enmType;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fHasHCHandler;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync } PhysicalRegister;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync struct
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync {
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPHYS GCPhys;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPHYS cb;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync PGMPHYSHANDLERTYPE enmType;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fHasHCHandler;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fRestoreAsRAM;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync } PhysicalDeregister;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync struct
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync {
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPHYS GCPhysOld;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPHYS GCPhysNew;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPHYS cb;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync PGMPHYSHANDLERTYPE enmType;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fHasHCHandler;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fRestoreAsRAM;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync } PhysicalModify;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint64_t padding[5];
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync } u;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t idxSelf;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t volatile idxNext;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync} REMHANDLERNOTIFICATION;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/** Pointer to a handler notification record. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsynctypedef REMHANDLERNOTIFICATION *PREMHANDLERNOTIFICATION;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/**
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * Converts a REM pointer into a VM pointer.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * @returns Pointer to the VM structure the REM is part of.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * @param pREM Pointer to REM instance data.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#define REM2VM(pREM) ( (PVM)((char*)pREM - pREM->offVM) )
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/**
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * REM Data (part of VM)
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsynctypedef struct REM
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync{
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Offset to the VM structure. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTINT offVM;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Alignment padding. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTUINT uPadding0;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Cached pointer of the register context of the current VCPU. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync R3PTRTYPE(PCPUMCTX) pCtx;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** In REM mode.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * I.e. the correct CPU state and some other bits are with REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool volatile fInREM;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** In REMR3State. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fInStateSync;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Set when the translation blocks cache need to be flushed. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fFlushTBs;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore CR3 load notifications from the REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fIgnoreCR3Load;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore invlpg notifications from the REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fIgnoreInvlPg;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore CR0, CR4 and EFER load. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fIgnoreCpuMode;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore set page. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fIgnoreSetPage;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool bPadding1;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore all that can be ignored. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t cIgnoreAll;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Number of times REMR3CanExecuteRaw has been called.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * It is used to prevent rescheduling on the first call. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t cCanExecuteRaw;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending interrupt (~0 -> nothing). */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t u32PendingInterrupt;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Number of recorded invlpg instructions. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t volatile cInvalidatedPages;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#if HC_ARCH_BITS == 32
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t uPadding2;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#endif
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Array of recorded invlpg instruction.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * These instructions are replayed when entering REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPTR aGCPtrInvalidatedPages[48];
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Array of recorded handler noticications.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * These are replayed when entering REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync REMHANDLERNOTIFICATION aHandlerNotifications[64];
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync volatile uint32_t idxPendingList;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync volatile uint32_t idxFreeList;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** MMIO memory type.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * This is used to register MMIO physical access handlers. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync int32_t iMMIOMemType;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Handler memory type.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * This is used to register non-MMIO physical access handlers which are executed in HC. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync int32_t iHandlerMemType;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending exception */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t uPendingException;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Nr of pending exceptions */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t cPendingExceptions;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending exception's EIP */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPTR uPendingExcptEIP;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending exception's CR2 */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPTR uPendingExcptCR2;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** The highest known RAM address. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync RTGCPHYS GCPhysLastRam;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Whether GCPhysLastRam has been fixed (see REMR3Init()). */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync bool fGCPhysLastRamFixed;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending rc. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync int32_t rc;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** REM critical section.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * This protects cpu_register_physical_memory usage
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync PDMCRITSECT CritSectRegister;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Time spent in QEMU. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync STAMPROFILEADV StatsInQEMU;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Time spent in rawmode.c. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync STAMPROFILEADV StatsInRAWEx;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Time spent switching state. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync STAMPROFILE StatsState;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Time spent switching state back. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync STAMPROFILE StatsStateBack;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Padding the CPUX86State structure to 32 byte. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync uint32_t abPadding[HC_ARCH_BITS == 32 ? 2 : 6];
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync# define REM_ENV_SIZE 0xff00
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Recompiler CPU state. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#ifdef REM_INCLUDE_CPU_H
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync CPUX86State Env;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync#else
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync struct FakeEnv
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync {
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync char achPadding[REM_ENV_SIZE];
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync } Env;
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#endif /* !REM_INCLUDE_CPU_H */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync} REM;
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/** Pointer to the REM Data. */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsynctypedef REM *PREM;
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#ifdef REM_INCLUDE_CPU_H
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncbool remR3CanExecuteRaw(CPUState *env, RTGCPTR eip, unsigned fFlags, int *piException);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3CSAMCheckEIP(CPUState *env, RTGCPTR GCPtrCode);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncbool remR3GetOpcode(CPUState *env, RTGCPTR GCPtrInstr, uint8_t *pu8Byte);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncbool remR3DisasInstr(CPUState *env, int f32BitCode, char *pszPrefix);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3FlushPage(CPUState *env, RTGCPTR GCPtr);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3SetPage(CPUState *env, CPUTLBEntry *pRead, CPUTLBEntry *pWrite, int prot, int is_user);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3FlushTLB(CPUState *env, bool fGlobal);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3ProtectCode(CPUState *env, RTGCPTR GCPtr);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3ChangeCpuMode(CPUState *env);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3DmaRun(CPUState *env);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3TimersRun(CPUState *env);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncint remR3NotifyTrap(CPUState *env, uint32_t uTrap, uint32_t uErrorCode, RTGCPTR pvNextEIP);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3TrapStat(CPUState *env, uint32_t uTrap);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3CpuId(CPUState *env, unsigned uOperator, void *pvEAX, void *pvEBX, void *pvECX, void *pvEDX);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3RecordCall(CPUState *env);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#endif /* REM_INCLUDE_CPU_H */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3TrapClear(PVM pVM);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3RaiseRC(PVM pVM, int rc);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3DumpLnxSyscall(PVMCPU pVCpu);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3DumpOBsdSyscall(PVMCPU pVCpu);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/** @todo r=bird: clean up the RAWEx stats. */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/* temporary hacks */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#define RAWEx_ProfileStart(a, b) remR3ProfileStart(b)
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#define RAWEx_ProfileStop(a, b) remR3ProfileStop(b)
7519a1c4323fa86fbb19a36a91cd25abfd7af714vboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#ifdef VBOX_WITH_STATISTICS
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define STATS_EMULATE_SINGLE_INSTR 1
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define STATS_QEMU_COMPILATION 2
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define STATS_QEMU_RUN_EMULATED_CODE 3
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define STATS_QEMU_TOTAL 4
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define STATS_QEMU_RUN_TIMERS 5
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define STATS_TLB_LOOKUP 6
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define STATS_IRQ_HANDLING 7
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define STATS_RAW_CHECK 8
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3ProfileStart(int statcode);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3ProfileStop(int statcode);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#else /* !VBOX_WITH_STATISTICS */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define remR3ProfileStart(c) do { } while (0)
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define remR3ProfileStop(c) do { } while (0)
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#endif /* !VBOX_WITH_STATISTICS */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/** @} */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#endif
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync