REMInternal.h revision ac396e25c413b9c9b382ba32667bc85d7bd51154
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * REM - Internal header file.
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync * Copyright (C) 2006-2007 Sun Microsystems, Inc.
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 * 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.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/** @defgroup grp_rem_int Internals
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * @ingroup grp_rem
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * @internal
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/** The saved state version number. */
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 /** The usual invalid 0 entry. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** REMR3NotifyHandlerPhysicalRegister. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** REMR3NotifyHandlerPhysicalDeregister. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** REMR3NotifyHandlerPhysicalModify. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** The usual 32-bit hack. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * A recorded handler notificiation.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** The notification kind. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Type specific data. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync/** Pointer to a handler notification record. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsynctypedef REMHANDLERNOTIFICATION *PREMHANDLERNOTIFICATION;
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#define REM2VM(pREM) ( (PVM)((char*)pREM - pREM->offVM) )
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * REM Data (part of VM)
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsynctypedef struct REM
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Offset to the VM structure. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Alignment padding. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Cached pointer of the register context of the current VCPU. */
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 /** Set when the translation blocks cache need to be flushed. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore CR3 load notifications from the REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore invlpg notifications from the REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore CR0, CR4 and EFER load. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore set page. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Ignore all that can be ignored. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Number of times REMR3CanExecuteRaw has been called.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * It is used to prevent rescheduling on the first call. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending interrupt (~0 -> nothing). */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Number of recorded invlpg instructions. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Array of recorded invlpg instruction.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * These instructions are replayed when entering REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Array of recorded handler noticications.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * These are replayed when entering REM. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** MMIO memory type.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * This is used to register MMIO physical access handlers. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Handler memory type.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * This is used to register non-MMIO physical access handlers which are executed in HC. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending exception */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Nr of pending exceptions */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending exception's EIP */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending exception's CR2 */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** The highest known RAM address. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Whether GCPhysLastRam has been fixed (see REMR3Init()). */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Pending rc. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** REM critical section.
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync * This protects cpu_register_physical_memory usage
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Time spent in QEMU. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Time spent in rawmode.c. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Time spent switching state. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Time spent switching state back. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Padding the CPUX86State structure to 32 byte. */
f6c43e9fc1e5cc41195ac222ad185905e33fe08dvboxsync /** Recompiler CPU state. */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#endif /* !REM_INCLUDE_CPU_H */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/** Pointer to the REM Data. */
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 remR3SetPage(CPUState *env, CPUTLBEntry *pRead, CPUTLBEntry *pWrite, int prot, int is_user);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3ProtectCode(CPUState *env, RTGCPTR GCPtr);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncint remR3NotifyTrap(CPUState *env, uint32_t uTrap, uint32_t uErrorCode, RTGCPTR pvNextEIP);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsyncvoid remR3CpuId(CPUState *env, unsigned uOperator, void *pvEAX, void *pvEBX, void *pvECX, void *pvEDX);
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#endif /* REM_INCLUDE_CPU_H */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/** @todo r=bird: clean up the RAWEx stats. */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync/* temporary hacks */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#define RAWEx_ProfileStart(a, b) remR3ProfileStart(b)
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#else /* !VBOX_WITH_STATISTICS */
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define remR3ProfileStart(c) do { } while (0)
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync# define remR3ProfileStop(c) do { } while (0)
09c9a430ad2caac61753f90b04a4989c6d54d13avboxsync#endif /* !VBOX_WITH_STATISTICS */