VirtualBox

Changeset 18143 in vbox


Ignore:
Timestamp:
Mar 23, 2009 3:10:24 PM (16 years ago)
Author:
vboxsync
Message:

VMM,Devices: Changed ROM registration and fixed some shadowed ROM issues in the new phys code.

Location:
trunk
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/VBox/pdmdev.h

    r18101 r18143  
    18981898     *                              This must be cbRange bytes big.
    18991899     *                              It will be copied and doesn't have to stick around if fShadow is clear.
    1900      * @param   fShadow             Whether to emulate ROM shadowing. This involves leaving
    1901      *                              the ROM writable for a while during the POST and refreshing
    1902      *                              it at reset. When this flag is set, the memory pointed to by
    1903      *                              pvBinary has to stick around for the lifespan of the VM.
     1900     * @param   fFlags              Shadow ROM flags, PGMPHYS_ROM_FLAGS_* in pgm.h.
    19041901     * @param   pszDesc             Pointer to description string. This must not be freed.
    19051902     *
     
    19071904     *          manually from the device yet. At present I doubt we need such features...
    19081905     */
    1909     DECLR3CALLBACKMEMBER(int, pfnROMRegister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc));
     1906    DECLR3CALLBACKMEMBER(int, pfnROMRegister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, uint32_t fFlags, const char *pszDesc));
    19101907
    19111908    /**
     
    19131910     *
    19141911     * @returns VBox status.
    1915      * @param   pDevIns         Device instance.
    1916      * @param   pszName         Data unit name.
    1917      * @param   u32Instance     The instance identifier of the data unit.
    1918      *                          This must together with the name be unique.
    1919      * @param   u32Version      Data layout version number.
    1920      * @param   cbGuess         The approximate amount of data in the unit.
    1921      *                          Only for progress indicators.
    1922      * @param   pfnSavePrep     Prepare save callback, optional.
    1923      * @param   pfnSaveExec     Execute save callback, optional.
    1924      * @param   pfnSaveDone     Done save callback, optional.
    1925      * @param   pfnLoadPrep     Prepare load callback, optional.
    1926      * @param   pfnLoadExec     Execute load callback, optional.
    1927      * @param   pfnLoadDone     Done load callback, optional.
     1912     * @param   pDevIns             Device instance.
     1913     * @param   pszName             Data unit name.
     1914     * @param   u32Instance         The instance identifier of the data unit.
     1915     *                              This must together with the name be unique.
     1916     * @param   u32Version          Data layout version number.
     1917     * @param   cbGuess             The approximate amount of data in the unit.
     1918     *                              Only for progress indicators.
     1919     * @param   pfnSavePrep         Prepare save callback, optional.
     1920     * @param   pfnSaveExec         Execute save callback, optional.
     1921     * @param   pfnSaveDone         Done save callback, optional.
     1922     * @param   pfnLoadPrep         Prepare load callback, optional.
     1923     * @param   pfnLoadExec         Execute load callback, optional.
     1924     * @param   pfnLoadDone         Done load callback, optional.
    19281925     */
    19291926    DECLR3CALLBACKMEMBER(int, pfnSSMRegister,(PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
     
    19351932     *
    19361933     * @returns VBox status.
    1937      * @param   pDevIns         Device instance.
    1938      * @param   enmClock        The clock to use on this timer.
    1939      * @param   pfnCallback     Callback function.
    1940      * @param   pszDesc         Pointer to description string which must stay around
    1941      *                          until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
    1942      * @param   ppTimer         Where to store the timer on success.
     1934     * @param   pDevIns             Device instance.
     1935     * @param   enmClock            The clock to use on this timer.
     1936     * @param   pfnCallback         Callback function.
     1937     * @param   pszDesc             Pointer to description string which must stay around
     1938     *                              until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
     1939     * @param   ppTimer             Where to store the timer on success.
    19431940     */
    19441941    DECLR3CALLBACKMEMBER(int, pfnTMTimerCreate,(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMERDEV pfnCallback, const char *pszDesc, PPTMTIMERR3 ppTimer));
     
    19481945     *
    19491946     * @returns timer pointer
    1950      * @param   pDevIns         Device instance.
    1951      * @param   enmClock        The clock to use on this timer.
    1952      * @param   pfnCallback     Callback function.
    1953      * @param   pvUser          User pointer
    1954      * @param   pszDesc         Pointer to description string which must stay around
    1955      *                          until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
     1947     * @param   pDevIns             Device instance.
     1948     * @param   enmClock            The clock to use on this timer.
     1949     * @param   pfnCallback         Callback function.
     1950     * @param   pvUser              User pointer
     1951     * @param   pszDesc             Pointer to description string which must stay around
     1952     *                              until the timer is fully destroyed (i.e. a bit after TMTimerDestroy()).
    19561953     */
    19571954    DECLR3CALLBACKMEMBER(PTMTIMERR3, pfnTMTimerCreateExternal,(PPDMDEVINS pDevIns, TMCLOCK enmClock, PFNTMTIMEREXT pfnCallback, void *pvUser, const char *pszDesc));
     
    19611958     *
    19621959     * @returns VBox status code.
    1963      * @param   pDevIns         Device instance.
    1964      * @param   pPciDev         The PCI device structure.
    1965      *                          Any PCI enabled device must keep this in it's instance data!
    1966      *                          Fill in the PCI data config before registration, please.
     1960     * @param   pDevIns             Device instance.
     1961     * @param   pPciDev             The PCI device structure.
     1962     *                              Any PCI enabled device must keep this in it's instance data!
     1963     *                              Fill in the PCI data config before registration, please.
    19671964     * @remark  This is the simple interface, a Ex interface will be created if
    19681965     *          more features are needed later.
     
    19741971     *
    19751972     * @returns VBox status code.
    1976      * @param   pDevIns         Device instance.
    1977      * @param   iRegion         The region number.
    1978      * @param   cbRegion        Size of the region.
    1979      * @param   enmType         PCI_ADDRESS_SPACE_MEM, PCI_ADDRESS_SPACE_IO or PCI_ADDRESS_SPACE_MEM_PREFETCH.
    1980      * @param   pfnCallback     Callback for doing the mapping.
     1973     * @param   pDevIns             Device instance.
     1974     * @param   iRegion             The region number.
     1975     * @param   cbRegion            Size of the region.
     1976     * @param   enmType             PCI_ADDRESS_SPACE_MEM, PCI_ADDRESS_SPACE_IO or PCI_ADDRESS_SPACE_MEM_PREFETCH.
     1977     * @param   pfnCallback         Callback for doing the mapping.
    19811978     */
    19821979    DECLR3CALLBACKMEMBER(int, pfnPCIIORegionRegister,(PPDMDEVINS pDevIns, int iRegion, uint32_t cbRegion, PCIADDRESSSPACE enmType, PFNPCIIOREGIONMAP pfnCallback));
     
    19851982     * Register PCI configuration space read/write callbacks.
    19861983     *
    1987      * @param   pDevIns         Device instance.
    1988      * @param   pPciDev         The PCI device structure.
    1989      *                          If NULL the default PCI device for this device instance is used.
    1990      * @param   pfnRead         Pointer to the user defined PCI config read function.
    1991      * @param   ppfnReadOld     Pointer to function pointer which will receive the old (default)
    1992      *                          PCI config read function. This way, user can decide when (and if)
    1993      *                          to call default PCI config read function. Can be NULL.
    1994      * @param   pfnWrite        Pointer to the user defined PCI config write function.
    1995      * @param   pfnWriteOld     Pointer to function pointer which will receive the old (default)
    1996      *                          PCI config write function. This way, user can decide when (and if)
    1997      *                          to call default PCI config write function. Can be NULL.
     1984     * @param   pDevIns             Device instance.
     1985     * @param   pPciDev             The PCI device structure.
     1986     *                              If NULL the default PCI device for this device instance is used.
     1987     * @param   pfnRead             Pointer to the user defined PCI config read function.
     1988     * @param   ppfnReadOld         Pointer to function pointer which will receive the old (default)
     1989     *                              PCI config read function. This way, user can decide when (and if)
     1990     *                              to call default PCI config read function. Can be NULL.
     1991     * @param   pfnWrite            Pointer to the user defined PCI config write function.
     1992     * @param   pfnWriteOld         Pointer to function pointer which will receive the old (default)
     1993     *                              PCI config write function. This way, user can decide when (and if)
     1994     *                              to call default PCI config write function. Can be NULL.
    19981995     * @thread  EMT
    19991996     */
     
    20042001     * Set the IRQ for a PCI device.
    20052002     *
    2006      * @param   pDevIns         Device instance.
    2007      * @param   iIrq            IRQ number to set.
    2008      * @param   iLevel          IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
     2003     * @param   pDevIns             Device instance.
     2004     * @param   iIrq                IRQ number to set.
     2005     * @param   iLevel              IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
    20092006     * @thread  Any thread, but will involve the emulation thread.
    20102007     */
     
    20152012     * the request when not called from EMT.
    20162013     *
    2017      * @param   pDevIns         Device instance.
    2018      * @param   iIrq            IRQ number to set.
    2019      * @param   iLevel          IRQ level.
     2014     * @param   pDevIns             Device instance.
     2015     * @param   iIrq                IRQ number to set.
     2016     * @param   iLevel              IRQ level.
    20202017     * @thread  Any thread, but will involve the emulation thread.
    20212018     */
     
    20252022     * Set ISA IRQ for a device.
    20262023     *
    2027      * @param   pDevIns         Device instance.
    2028      * @param   iIrq            IRQ number to set.
    2029      * @param   iLevel          IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
     2024     * @param   pDevIns             Device instance.
     2025     * @param   iIrq                IRQ number to set.
     2026     * @param   iLevel              IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
    20302027     * @thread  Any thread, but will involve the emulation thread.
    20312028     */
     
    20362033     * the request when not called from EMT.
    20372034     *
    2038      * @param   pDevIns         Device instance.
    2039      * @param   iIrq            IRQ number to set.
    2040      * @param   iLevel          IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
     2035     * @param   pDevIns             Device instance.
     2036     * @param   iIrq                IRQ number to set.
     2037     * @param   iLevel              IRQ level. See the PDM_IRQ_LEVEL_* \#defines.
    20412038     * @thread  Any thread, but will involve the emulation thread.
    20422039     */
     
    20642061     *
    20652062     * @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
    2066      * @param   pDevIns         Device instance.
    2067      * @param   cb              Number of bytes to allocate.
     2063     * @param   pDevIns             Device instance.
     2064     * @param   cb                  Number of bytes to allocate.
    20682065     */
    20692066    DECLR3CALLBACKMEMBER(void *, pfnMMHeapAlloc,(PPDMDEVINS pDevIns, size_t cb));
     
    20742071     *
    20752072     * @returns Pointer to allocated memory. The memory is *NOT* zero-ed.
    2076      * @param   pDevIns         Device instance.
    2077      * @param   cb              Number of bytes to allocate.
     2073     * @param   pDevIns             Device instance.
     2074     * @param   cb                  Number of bytes to allocate.
    20782075     */
    20792076    DECLR3CALLBACKMEMBER(void *, pfnMMHeapAllocZ,(PPDMDEVINS pDevIns, size_t cb));
     
    20822079     * Free memory allocated with pfnMMHeapAlloc() and pfnMMHeapAllocZ().
    20832080     *
    2084      * @param   pDevIns         Device instance.
    2085      * @param   pv              Pointer to the memory to free.
     2081     * @param   pDevIns             Device instance.
     2082     * @param   pv                  Pointer to the memory to free.
    20862083     */
    20872084    DECLR3CALLBACKMEMBER(void, pfnMMHeapFree,(PPDMDEVINS pDevIns, void *pv));
     
    20912088     *
    20922089     * @returns rc.
    2093      * @param   pDevIns         Device instance.
    2094      * @param   rc              VBox status code.
    2095      * @param   RT_SRC_POS_DECL Use RT_SRC_POS.
    2096      * @param   pszFormat       Error message format string.
    2097      * @param   ...             Error message arguments.
     2090     * @param   pDevIns             Device instance.
     2091     * @param   rc                  VBox status code.
     2092     * @param   RT_SRC_POS_DECL     Use RT_SRC_POS.
     2093     * @param   pszFormat           Error message format string.
     2094     * @param   ...                 Error message arguments.
    20982095     */
    20992096    DECLR3CALLBACKMEMBER(int, pfnVMSetError,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, ...));
     
    21032100     *
    21042101     * @returns rc.
    2105      * @param   pDevIns         Device instance.
    2106      * @param   rc              VBox status code.
    2107      * @param   RT_SRC_POS_DECL Use RT_SRC_POS.
    2108      * @param   pszFormat       Error message format string.
    2109      * @param   va              Error message arguments.
     2102     * @param   pDevIns             Device instance.
     2103     * @param   rc                  VBox status code.
     2104     * @param   RT_SRC_POS_DECL     Use RT_SRC_POS.
     2105     * @param   pszFormat           Error message format string.
     2106     * @param   va                  Error message arguments.
    21102107     */
    21112108    DECLR3CALLBACKMEMBER(int, pfnVMSetErrorV,(PPDMDEVINS pDevIns, int rc, RT_SRC_POS_DECL, const char *pszFormat, va_list va));
     
    21152112     *
    21162113     * @returns VBox status code.
    2117      * @param   pDevIns         Device instance.
    2118      * @param   fFatal          Whether it is a fatal error or not.
    2119      * @param   pszErrorID      Error ID string.
    2120      * @param   pszFormat       Error message format string.
    2121      * @param   ...             Error message arguments.
     2114     * @param   pDevIns             Device instance.
     2115     * @param   fFatal              Whether it is a fatal error or not.
     2116     * @param   pszErrorID          Error ID string.
     2117     * @param   pszFormat           Error message format string.
     2118     * @param   ...                 Error message arguments.
    21222119     */
    21232120    DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeError,(PPDMDEVINS pDevIns, bool fFatal, const char *pszErrorID, const char *pszFormat, ...));
     
    21272124     *
    21282125     * @returns VBox status code.
    2129      * @param   pDevIns         Device instance.
    2130      * @param   fFatal          Whether it is a fatal error or not.
    2131      * @param   pszErrorID      Error ID string.
    2132      * @param   pszFormat       Error message format string.
    2133      * @param   va              Error message arguments.
     2126     * @param   pDevIns             Device instance.
     2127     * @param   fFatal              Whether it is a fatal error or not.
     2128     * @param   pszErrorID          Error ID string.
     2129     * @param   pszFormat           Error message format string.
     2130     * @param   va                  Error message arguments.
    21342131     */
    21352132    DECLR3CALLBACKMEMBER(int, pfnVMSetRuntimeErrorV,(PPDMDEVINS pDevIns, bool fFatal, const char *pszErrorID, const char *pszFormat, va_list va));
     
    21402137     * @returns True if correct.
    21412138     * @returns False if wrong.
    2142      * @param   pDevIns         Device instance.
    2143      * @param   pszFile         Filename of the assertion location.
    2144      * @param   iLine           The linenumber of the assertion location.
    2145      * @param   pszFunction     Function of the assertion location.
     2139     * @param   pDevIns             Device instance.
     2140     * @param   pszFile             Filename of the assertion location.
     2141     * @param   iLine               The linenumber of the assertion location.
     2142     * @param   pszFunction         Function of the assertion location.
    21462143     */
    21472144    DECLR3CALLBACKMEMBER(bool, pfnAssertEMT,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction));
     
    21522149     * @returns True if correct.
    21532150     * @returns False if wrong.
    2154      * @param   pDevIns         Device instance.
    2155      * @param   pszFile         Filename of the assertion location.
    2156      * @param   iLine           The linenumber of the assertion location.
    2157      * @param   pszFunction     Function of the assertion location.
     2151     * @param   pDevIns             Device instance.
     2152     * @param   pszFile             Filename of the assertion location.
     2153     * @param   iLine               The linenumber of the assertion location.
     2154     * @param   pszFunction         Function of the assertion location.
    21582155     */
    21592156    DECLR3CALLBACKMEMBER(bool, pfnAssertOther,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction));
     
    21662163     *
    21672164     * @returns VBox status code which must be passed up to the VMM.
    2168      * @param   pDevIns         Device instance.
    2169      * @param   pszFile         Filename of the assertion location.
    2170      * @param   iLine           The linenumber of the assertion location.
    2171      * @param   pszFunction     Function of the assertion location.
    2172      * @param   pszFormat       Message. (optional)
    2173      * @param   args            Message parameters.
     2165     * @param   pDevIns             Device instance.
     2166     * @param   pszFile             Filename of the assertion location.
     2167     * @param   iLine               The linenumber of the assertion location.
     2168     * @param   pszFunction         Function of the assertion location.
     2169     * @param   pszFormat           Message. (optional)
     2170     * @param   args                Message parameters.
    21742171     */
    21752172    DECLR3CALLBACKMEMBER(int, pfnDBGFStopV,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction, const char *pszFormat, va_list args));
     
    21792176     *
    21802177     * @returns VBox status code.
    2181      * @param   pDevIns         Device instance.
    2182      * @param   pszName         The identifier of the info.
    2183      * @param   pszDesc         The description of the info and any arguments the handler may take.
    2184      * @param   pfnHandler      The handler function to be called to display the info.
     2178     * @param   pDevIns             Device instance.
     2179     * @param   pszName             The identifier of the info.
     2180     * @param   pszDesc             The description of the info and any arguments
     2181     *                              the handler may take.
     2182     * @param   pfnHandler          The handler function to be called to display the
     2183     *                              info.
    21852184     */
    21862185    DECLR3CALLBACKMEMBER(int, pfnDBGFInfoRegister,(PPDMDEVINS pDevIns, const char *pszName, const char *pszDesc, PFNDBGFHANDLERDEV pfnHandler));
     
    21892188     * Registers a statistics sample if statistics are enabled.
    21902189     *
    2191      * @param   pDevIns         Device instance of the DMA.
    2192      * @param   pvSample        Pointer to the sample.
    2193      * @param   enmType         Sample type. This indicates what pvSample is pointing at.
    2194      * @param   pszName         Sample name. The name is on this form "/<component>/<sample>".
    2195      *                          Further nesting is possible.
    2196      * @param   enmUnit         Sample unit.
    2197      * @param   pszDesc         Sample description.
     2190     * @param   pDevIns             Device instance of the DMA.
     2191     * @param   pvSample            Pointer to the sample.
     2192     * @param   enmType             Sample type. This indicates what pvSample is
     2193     *                              pointing at.
     2194     * @param   pszName             Sample name. The name is on this form
     2195     *                              "/<component>/<sample>". Further nesting is
     2196     *                              possible.
     2197     * @param   enmUnit             Sample unit.
     2198     * @param   pszDesc             Sample description.
    21982199     */
    21992200    DECLR3CALLBACKMEMBER(void, pfnSTAMRegister,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, const char *pszName, STAMUNIT enmUnit, const char *pszDesc));
     
    22042205     *
    22052206     * @returns VBox status.
    2206      * @param   pDevIns         Device instance of the DMA.
    2207      * @param   pvSample        Pointer to the sample.
    2208      * @param   enmType         Sample type. This indicates what pvSample is pointing at.
    2209      * @param   enmVisibility   Visibility type specifying whether unused statistics should be visible or not.
    2210      * @param   enmUnit         Sample unit.
    2211      * @param   pszDesc         Sample description.
    2212      * @param   pszName         The sample name format string.
    2213      * @param   ...             Arguments to the format string.
     2207     * @param   pDevIns             Device instance of the DMA.
     2208     * @param   pvSample            Pointer to the sample.
     2209     * @param   enmType             Sample type. This indicates what pvSample is
     2210     *                              pointing at.
     2211     * @param   enmVisibility       Visibility type specifying whether unused
     2212     *                              statistics should be visible or not.
     2213     * @param   enmUnit             Sample unit.
     2214     * @param   pszDesc             Sample description.
     2215     * @param   pszName             The sample name format string.
     2216     * @param   ...                 Arguments to the format string.
    22142217     */
    22152218    DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterF,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
     
    22212224     *
    22222225     * @returns VBox status.
    2223      * @param   pDevIns         Device instance of the DMA.
    2224      * @param   pvSample        Pointer to the sample.
    2225      * @param   enmType         Sample type. This indicates what pvSample is pointing at.
    2226      * @param   enmVisibility   Visibility type specifying whether unused statistics should be visible or not.
    2227      * @param   enmUnit         Sample unit.
    2228      * @param   pszDesc         Sample description.
    2229      * @param   pszName         The sample name format string.
    2230      * @param   args            Arguments to the format string.
     2226     * @param   pDevIns             Device instance of the DMA.
     2227     * @param   pvSample            Pointer to the sample.
     2228     * @param   enmType             Sample type. This indicates what pvSample is
     2229     *                              pointing at.
     2230     * @param   enmVisibility       Visibility type specifying whether unused
     2231     *                              statistics should be visible or not.
     2232     * @param   enmUnit             Sample unit.
     2233     * @param   pszDesc             Sample description.
     2234     * @param   pszName             The sample name format string.
     2235     * @param   args                Arguments to the format string.
    22312236     */
    22322237    DECLR3CALLBACKMEMBER(void, pfnSTAMRegisterV,(PPDMDEVINS pDevIns, void *pvSample, STAMTYPE enmType, STAMVISIBILITY enmVisibility,
     
    22372242     *
    22382243     * @returns VBox status code.
    2239      * @param   pDevIns         Device instance.
    2240      * @param   pRtcReg         Pointer to a RTC registration structure.
    2241      * @param   ppRtcHlp        Where to store the pointer to the helper functions.
     2244     * @param   pDevIns             Device instance.
     2245     * @param   pRtcReg             Pointer to a RTC registration structure.
     2246     * @param   ppRtcHlp            Where to store the pointer to the helper
     2247     *                              functions.
    22422248     */
    22432249    DECLR3CALLBACKMEMBER(int, pfnRTCRegister,(PPDMDEVINS pDevIns, PCPDMRTCREG pRtcReg, PCPDMRTCHLP *ppRtcHlp));
     
    22672273     *
    22682274     * @returns VBox status code.
    2269      * @param   pDevIns         Device instance.
    2270      * @param   pCritSect       Pointer to the critical section.
    2271      * @param   pszName         The name of the critical section (for statistics).
     2275     * @param   pDevIns             Device instance.
     2276     * @param   pCritSect           Pointer to the critical section.
     2277     * @param   pszName             The name of the critical section (for
     2278     *                              statistics).
    22722279     */
    22732280    DECLR3CALLBACKMEMBER(int, pfnCritSectInit,(PPDMDEVINS pDevIns, PPDMCRITSECT pCritSect, const char *pszName));
     
    22772284     *
    22782285     * @returns pTime.
    2279      * @param   pDevIns         Device instance.
    2280      * @param   pTime           Where to store the time.
     2286     * @param   pDevIns             Device instance.
     2287     * @param   pTime               Where to store the time.
    22812288     */
    22822289    DECLR3CALLBACKMEMBER(PRTTIMESPEC, pfnUTCNow,(PPDMDEVINS pDevIns, PRTTIMESPEC pTime));
     
    22892296     *
    22902297     * @returns VBox status code.
    2291      * @param   pDevIns     The device instance.
    2292      * @param   ppThread    Where to store the thread 'handle'.
    2293      * @param   pvUser      The user argument to the thread function.
    2294      * @param   pfnThread   The thread function.
    2295      * @param   pfnWakeup   The wakup callback. This is called on the EMT thread when
    2296      *                      a state change is pending.
    2297      * @param   cbStack     See RTThreadCreate.
    2298      * @param   enmType     See RTThreadCreate.
    2299      * @param   pszName     See RTThreadCreate.
     2298     * @param   pDevIns             The device instance.
     2299     * @param   ppThread            Where to store the thread 'handle'.
     2300     * @param   pvUser              The user argument to the thread function.
     2301     * @param   pfnThread           The thread function.
     2302     * @param   pfnWakeup           The wakup callback. This is called on the EMT
     2303     *                              thread when a state change is pending.
     2304     * @param   cbStack             See RTThreadCreate.
     2305     * @param   enmType             See RTThreadCreate.
     2306     * @param   pszName             See RTThreadCreate.
    23002307     */
    23012308    DECLR3CALLBACKMEMBER(int, pfnPDMThreadCreate,(PPDMDEVINS pDevIns, PPPDMTHREAD ppThread, void *pvUser, PFNPDMTHREADDEV pfnThread,
     
    23062313     *
    23072314     * @returns VBox status code.
    2308      * @param   pDevIns         Device instance.
    2309      * @param   GCPtr           Guest virtual address.
    2310      * @param   pGCPhys         Where to store the GC physical address corresponding to GCPtr.
     2315     * @param   pDevIns             Device instance.
     2316     * @param   GCPtr               Guest virtual address.
     2317     * @param   pGCPhys             Where to store the GC physical address
     2318     *                              corresponding to GCPtr.
    23112319     * @thread  The emulation thread.
    23122320     * @remark  Careful with page boundraries.
     
    23182326     *
    23192327     * @returns VM state.
    2320      * @param   pDevIns         The device instance.
     2328     * @param   pDevIns             The device instance.
    23212329     * @thread  Any thread (just keep in mind that it's volatile info).
    23222330     */
     
    23462354     *
    23472355     * @returns VM Handle.
    2348      * @param   pDevIns         Device instance.
     2356     * @param   pDevIns             Device instance.
    23492357     */
    23502358    DECLR3CALLBACKMEMBER(PVM, pfnGetVM,(PPDMDEVINS pDevIns));
     
    23542362     *
    23552363     * @returns VBox status code.
    2356      * @param   pDevIns         Device instance.
    2357      * @param   pPciBusReg      Pointer to PCI bus registration structure.
    2358      * @param   ppPciHlpR3      Where to store the pointer to the PCI Bus helpers.
     2364     * @param   pDevIns             Device instance.
     2365     * @param   pPciBusReg          Pointer to PCI bus registration structure.
     2366     * @param   ppPciHlpR3          Where to store the pointer to the PCI Bus
     2367     *                              helpers.
    23592368     */
    23602369    DECLR3CALLBACKMEMBER(int, pfnPCIBusRegister,(PPDMDEVINS pDevIns, PPDMPCIBUSREG pPciBusReg, PCPDMPCIHLPR3 *ppPciHlpR3));
     
    23642373     *
    23652374     * @returns VBox status code.
    2366      * @param   pDevIns         Device instance.
    2367      * @param   pPicReg         Pointer to a PIC registration structure.
    2368      * @param   ppPicHlpR3      Where to store the pointer to the PIC HC helpers.
     2375     * @param   pDevIns             Device instance.
     2376     * @param   pPicReg             Pointer to a PIC registration structure.
     2377     * @param   ppPicHlpR3          Where to store the pointer to the PIC HC
     2378     *                              helpers.
    23692379     */
    23702380    DECLR3CALLBACKMEMBER(int, pfnPICRegister,(PPDMDEVINS pDevIns, PPDMPICREG pPicReg, PCPDMPICHLPR3 *ppPicHlpR3));
     
    23742384     *
    23752385     * @returns VBox status code.
    2376      * @param   pDevIns         Device instance.
    2377      * @param   pApicReg        Pointer to a APIC registration structure.
    2378      * @param   ppApicHlpR3     Where to store the pointer to the APIC helpers.
     2386     * @param   pDevIns             Device instance.
     2387     * @param   pApicReg            Pointer to a APIC registration structure.
     2388     * @param   ppApicHlpR3         Where to store the pointer to the APIC helpers.
    23792389     */
    23802390    DECLR3CALLBACKMEMBER(int, pfnAPICRegister,(PPDMDEVINS pDevIns, PPDMAPICREG pApicReg, PCPDMAPICHLPR3 *ppApicHlpR3));
     
    23842394     *
    23852395     * @returns VBox status code.
    2386      * @param   pDevIns         Device instance.
    2387      * @param   pIoApicReg      Pointer to a I/O APIC registration structure.
    2388      * @param   ppIoApicHlpR3   Where to store the pointer to the IOAPIC helpers.
     2396     * @param   pDevIns             Device instance.
     2397     * @param   pIoApicReg          Pointer to a I/O APIC registration structure.
     2398     * @param   ppIoApicHlpR3       Where to store the pointer to the IOAPIC
     2399     *                              helpers.
    23892400     */
    23902401    DECLR3CALLBACKMEMBER(int, pfnIOAPICRegister,(PPDMDEVINS pDevIns, PPDMIOAPICREG pIoApicReg, PCPDMIOAPICHLPR3 *ppIoApicHlpR3));
     
    23942405     *
    23952406     * @returns VBox status code.
    2396      * @param   pDevIns         Device instance.
    2397      * @param   pDmacReg        Pointer to a DMAC registration structure.
    2398      * @param   ppDmacHlp       Where to store the pointer to the DMA helpers.
     2407     * @param   pDevIns             Device instance.
     2408     * @param   pDmacReg            Pointer to a DMAC registration structure.
     2409     * @param   ppDmacHlp           Where to store the pointer to the DMA helpers.
    23992410     */
    24002411    DECLR3CALLBACKMEMBER(int, pfnDMACRegister,(PPDMDEVINS pDevIns, PPDMDMACREG pDmacReg, PCPDMDMACHLP *ppDmacHlp));
     
    24022413    /**
    24032414     * Read physical memory.
    2404      * 
     2415     *
    24052416     * @returns VINF_SUCCESS (for now).
    2406      * @param   pDevIns         Device instance.
    2407      * @param   GCPhys          Physical address start reading from.
    2408      * @param   pvBuf           Where to put the read bits.
    2409      * @param   cbRead          How many bytes to read.
     2417     * @param   pDevIns             Device instance.
     2418     * @param   GCPhys              Physical address start reading from.
     2419     * @param   pvBuf               Where to put the read bits.
     2420     * @param   cbRead              How many bytes to read.
    24102421     * @thread  Any thread, but the call may involve the emulation thread.
    24112422     */
     
    24162427     *
    24172428     * @returns VINF_SUCCESS for now, and later maybe VERR_EM_MEMORY.
    2418      * @param   pDevIns         Device instance.
    2419      * @param   GCPhys          Physical address to write to.
    2420      * @param   pvBuf           What to write.
    2421      * @param   cbWrite         How many bytes to write.
     2429     * @param   pDevIns             Device instance.
     2430     * @param   GCPhys              Physical address to write to.
     2431     * @param   pvBuf               What to write.
     2432     * @param   cbWrite             How many bytes to write.
    24222433     * @thread  Any thread, but the call may involve the emulation thread.
    24232434     */
     
    24282439     *
    24292440     * When you're done with the page, call pfnPhysReleasePageMappingLock() ASAP to
    2430      * release it. 
    2431      *
    2432      * This API will assume your intention is to write to the page, and will 
    2433      * therefore replace shared and zero pages. If you do not intend to modify the 
    2434      * page, use the pfnPhysGCPhys2CCPtrReadOnly() API. 
     2441     * release it.
     2442     *
     2443     * This API will assume your intention is to write to the page, and will
     2444     * therefore replace shared and zero pages. If you do not intend to modify the
     2445     * page, use the pfnPhysGCPhys2CCPtrReadOnly() API.
    24352446     *
    24362447     * @returns VBox status code.
    24372448     * @retval  VINF_SUCCESS on success.
    2438      * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical 
     2449     * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical
    24392450     *          backing or if the page has any active access handlers. The caller
    24402451     *          must fall back on using PGMR3PhysWriteExternal.
    24412452     * @retval  VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address.
    24422453     *
    2443      * @param   pVM             The VM handle.
    2444      * @param   GCPhys          The guest physical address of the page that should be mapped.
    2445      * @param   fFlags          Flags reserved for future use, MBZ.
    2446      * @param   ppv             Where to store the address corresponding to GCPhys.
    2447      * @param   pLock           Where to store the lock information that
    2448      *                          pfnPhysReleasePageMappingLock needs.
     2454     * @param   pVM                 The VM handle.
     2455     * @param   GCPhys              The guest physical address of the page that
     2456     *                              should be mapped.
     2457     * @param   fFlags              Flags reserved for future use, MBZ.
     2458     * @param   ppv                 Where to store the address corresponding to
     2459     *                              GCPhys.
     2460     * @param   pLock               Where to store the lock information that
     2461     *                              pfnPhysReleasePageMappingLock needs.
    24492462     *
    24502463     * @remark  Avoid calling this API from within critical sections (other than the
     
    24572470    /**
    24582471     * Requests the mapping of a guest page into ring-3, external threads.
    2459      * 
     2472     *
    24602473     * When you're done with the page, call pfnPhysReleasePageMappingLock() ASAP to
    24612474     * release it.
     
    24632476     * @returns VBox status code.
    24642477     * @retval  VINF_SUCCESS on success.
    2465      * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical 
     2478     * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical
    24662479     *          backing or if the page as an active ALL access handler. The caller
    24672480     *          must fall back on using PGMPhysRead.
    24682481     * @retval  VERR_PGM_INVALID_GC_PHYSICAL_ADDRESS if it's not a valid physical address.
    24692482     *
    2470      * @param   pDevIns         Device instance.
    2471      * @param   GCPhys          The guest physical address of the page that should be mapped.
    2472      * @param   fFlags          Flags reserved for future use, MBZ.
    2473      * @param   ppv             Where to store the address corresponding to GCPhys.
    2474      * @param   pLock           Where to store the lock information that
    2475      *                          pfnPhysReleasePageMappingLock needs.
    2476      *
    2477      * @remark  Avoid calling this API from within critical sections.
     2483     * @param   pDevIns             Device instance.
     2484     * @param   GCPhys              The guest physical address of the page that
     2485     *                              should be mapped.
     2486     * @param   fFlags              Flags reserved for future use, MBZ.
     2487     * @param   ppv                 Where to store the address corresponding to
     2488     *                              GCPhys.
     2489     * @param   pLock               Where to store the lock information that
     2490     *                              pfnPhysReleasePageMappingLock needs.
     2491     *
     2492     * @remark  Avoid calling this API from within critical sections.
    24782493     * @thread  Any.
    24792494     */
     
    24832498     * Release the mapping of a guest page.
    24842499     *
    2485      * This is the counter part of pfnPhysGCPhys2CCPtr and
    2486      * pfnPhysGCPhys2CCPtrReadOnly.
    2487      *
    2488      * @param   pDevIns         Device instance.
    2489      * @param   pLock           The lock structure initialized by the mapping function.
     2500     * This is the counter part of pfnPhysGCPhys2CCPtr and
     2501     * pfnPhysGCPhys2CCPtrReadOnly.
     2502     *
     2503     * @param   pDevIns             Device instance.
     2504     * @param   pLock               The lock structure initialized by the mapping
     2505     *                              function.
    24902506     */
    24912507    DECLR3CALLBACKMEMBER(void, pfnPhysReleasePageMappingLock,(PPDMDEVINS pDevIns, PPGMPAGEMAPLOCK pLock));
     
    24942510     * Read guest physical memory by virtual address.
    24952511     *
    2496      * @param   pDevIns         Device instance.
    2497      * @param   pvDst           Where to put the read bits.
    2498      * @param   GCVirtSrc       Guest virtual address to start reading from.
    2499      * @param   cb              How many bytes to read.
     2512     * @param   pDevIns             Device instance.
     2513     * @param   pvDst               Where to put the read bits.
     2514     * @param   GCVirtSrc           Guest virtual address to start reading from.
     2515     * @param   cb                  How many bytes to read.
    25002516     * @thread  The emulation thread.
    25012517     */
     
    25052521     * Write to guest physical memory by virtual address.
    25062522     *
    2507      * @param   pDevIns         Device instance.
    2508      * @param   GCVirtDst       Guest virtual address to write to.
    2509      * @param   pvSrc           What to write.
    2510      * @param   cb              How many bytes to write.
     2523     * @param   pDevIns             Device instance.
     2524     * @param   GCVirtDst           Guest virtual address to write to.
     2525     * @param   pvSrc               What to write.
     2526     * @param   cb                  How many bytes to write.
    25112527     * @thread  The emulation thread.
    25122528     */
     
    25182534     * @returns true if A20 is enabled.
    25192535     * @returns false if A20 is disabled.
    2520      * @param   pDevIns         Device instance.
     2536     * @param   pDevIns             Device instance.
    25212537     * @thread  The emulation thread.
    25222538     */
     
    25262542     * Enables or disables the Gate A20.
    25272543     *
    2528      * @param   pDevIns         Device instance.
    2529      * @param   fEnable         Set this flag to enable the Gate A20; clear it to disable.
     2544     * @param   pDevIns             Device instance.
     2545     * @param   fEnable             Set this flag to enable the Gate A20; clear it
     2546     *                              to disable.
    25302547     * @thread  The emulation thread.
    25312548     */
     
    25362553     *
    25372554     * @returns The appropriate VBox status code to pass around on reset.
    2538      * @param   pDevIns         Device instance.
     2555     * @param   pDevIns             Device instance.
    25392556     * @thread  The emulation thread.
    25402557     */
     
    25452562     *
    25462563     * @returns The appropriate VBox status code to pass around on suspend.
    2547      * @param   pDevIns         Device instance.
     2564     * @param   pDevIns             Device instance.
    25482565     * @thread  The emulation thread.
    25492566     */
     
    25542571     *
    25552572     * @returns The appropriate VBox status code to pass around on power off.
    2556      * @param   pDevIns         Device instance.
     2573     * @param   pDevIns             Device instance.
    25572574     * @thread  The emulation thread.
    25582575     */
     
    25632580     *
    25642581     * @returns VBox status code
    2565      * @param   pDevIns         Device instance.
     2582     * @param   pDevIns             Device instance.
    25662583     */
    25672584    DECLR3CALLBACKMEMBER(int , pfnLockVM,(PPDMDEVINS pDevIns));
     
    25712588     *
    25722589     * @returns VBox status code
    2573      * @param   pDevIns         Device instance.
     2590     * @param   pDevIns             Device instance.
    25742591     */
    25752592    DECLR3CALLBACKMEMBER(int, pfnUnlockVM,(PPDMDEVINS pDevIns));
     
    25792596     *
    25802597     * @returns boolean
    2581      * @param   pDevIns         Device instance.
    2582      * @param   pszFile         Filename of the assertion location.
    2583      * @param   iLine           Linenumber of the assertion location.
    2584      * @param   pszFunction     Function of the assertion location.
     2598     * @param   pDevIns             Device instance.
     2599     * @param   pszFile             Filename of the assertion location.
     2600     * @param   iLine               Linenumber of the assertion location.
     2601     * @param   pszFunction         Function of the assertion location.
    25852602     */
    25862603    DECLR3CALLBACKMEMBER(bool, pfnAssertVMLock,(PPDMDEVINS pDevIns, const char *pszFile, unsigned iLine, const char *pszFunction));
     
    26022619     *
    26032620     * @returns VBox status code.
    2604      * @param   pDevIns         Device instance.
    2605      * @param   uChannel        Channel number.
    2606      * @param   pvBuffer        Pointer to target buffer.
    2607      * @param   off             DMA position.
    2608      * @param   cbBlock         Block size.
    2609      * @param   pcbRead         Where to store the number of bytes which was read. optional.
     2621     * @param   pDevIns             Device instance.
     2622     * @param   uChannel            Channel number.
     2623     * @param   pvBuffer            Pointer to target buffer.
     2624     * @param   off                 DMA position.
     2625     * @param   cbBlock             Block size.
     2626     * @param   pcbRead             Where to store the number of bytes which was
     2627     *                              read. optional.
    26102628     * @thread  EMT
    26112629     */
     
    26162634     *
    26172635     * @returns VBox status code.
    2618      * @param   pDevIns         Device instance.
    2619      * @param   uChannel        Channel number.
    2620      * @param   pvBuffer        Memory to write.
    2621      * @param   off             DMA position.
    2622      * @param   cbBlock         Block size.
    2623      * @param   pcbWritten      Where to store the number of bytes which was written. optional.
     2636     * @param   pDevIns             Device instance.
     2637     * @param   uChannel            Channel number.
     2638     * @param   pvBuffer            Memory to write.
     2639     * @param   off                 DMA position.
     2640     * @param   cbBlock             Block size.
     2641     * @param   pcbWritten          Where to store the number of bytes which was
     2642     *                              written. optional.
    26242643     * @thread  EMT
    26252644     */
     
    26302649     *
    26312650     * @returns VBox status code.
    2632      * @param pDevIns           Device instance.
    2633      * @param uChannel          Channel number.
    2634      * @param uLevel            Level of the line.
     2651     * @param pDevIns               Device instance.
     2652     * @param uChannel              Channel number.
     2653     * @param uLevel                Level of the line.
    26352654     * @thread  EMT
    26362655     */
     
    26412660     *
    26422661     * @returns Channel mode. See specs.
    2643      * @param   pDevIns         Device instance.
    2644      * @param   uChannel        Channel number.
     2662     * @param   pDevIns             Device instance.
     2663     * @param   uChannel            Channel number.
    26452664     * @thread  EMT
    26462665     */
     
    26502669     * Schedule DMA execution.
    26512670     *
    2652      * @param   pDevIns         Device instance.
     2671     * @param   pDevIns             Device instance.
    26532672     * @thread  Any thread.
    26542673     */
     
    26592678     *
    26602679     * @returns VBox status code.
    2661      * @param   pDevIns     Device instance.
    2662      * @param   iReg        The CMOS register index.
    2663      * @param   u8Value     The CMOS register value.
     2680     * @param   pDevIns             Device instance.
     2681     * @param   iReg                The CMOS register index.
     2682     * @param   u8Value             The CMOS register value.
    26642683     * @thread  EMT
    26652684     */
     
    26702689     *
    26712690     * @returns VBox status code.
    2672      * @param   pDevIns     Device instance.
    2673      * @param   iReg        The CMOS register index.
    2674      * @param   pu8Value    Where to store the CMOS register value.
     2691     * @param   pDevIns             Device instance.
     2692     * @param   iReg                The CMOS register index.
     2693     * @param   pu8Value            Where to store the CMOS register value.
    26752694     * @thread  EMT
    26762695     */
     
    26802699     * Get CPUID.
    26812700     *
    2682      * @param   pDevIns     Device instance.
    2683      * @param   iLeaf       The CPUID leaf to get.
    2684      * @param   pEax        Where to store the EAX value.
    2685      * @param   pEbx        Where to store the EBX value.
    2686      * @param   pEcx        Where to store the ECX value.
    2687      * @param   pEdx        Where to store the EDX value.
     2701     * @param   pDevIns             Device instance.
     2702     * @param   iLeaf               The CPUID leaf to get.
     2703     * @param   pEax                Where to store the EAX value.
     2704     * @param   pEbx                Where to store the EBX value.
     2705     * @param   pEcx                Where to store the ECX value.
     2706     * @param   pEdx                Where to store the EDX value.
    26882707     */
    26892708    DECLR3CALLBACKMEMBER(void, pfnGetCpuId,(PPDMDEVINS pDevIns, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx));
     
    26952714     * change the protection of shadowed ROM code after init and on reset.
    26962715     *
    2697      * @param   pDevIns     Device instance.
    2698      * @param   GCPhysStart Where the mapping starts.
    2699      * @param   cbRange     The size of the mapping.
    2700      * @param   enmProt     The new protection type.
     2716     * @param   pDevIns             Device instance.
     2717     * @param   GCPhysStart         Where the mapping starts.
     2718     * @param   cbRange             The size of the mapping.
     2719     * @param   enmProt             The new protection type.
    27012720     */
    27022721    DECLR3CALLBACKMEMBER(int, pfnROMProtectShadow,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, PGMROMPROT enmProt));
     
    27102729     *
    27112730     * @returns VBox status.
    2712      * @param   pDevIns         The device instance.
    2713      * @param   iRegion         The region number. Use the PCI region number as
    2714      *                          this must be known to the PCI bus device too. If it's not associated
    2715      *                          with the PCI device, then any number up to UINT8_MAX is fine.
    2716      * @param   cb              The size (in bytes) of the region.
    2717      * @param   fFlags          Reserved for future use, must be zero.
    2718      * @param   ppv             Where to store the address of the ring-3 mapping of the memory.
    2719      * @param   pszDesc         Pointer to description string. This must not be freed.
     2731     * @param   pDevIns             The device instance.
     2732     * @param   iRegion             The region number. Use the PCI region number as
     2733     *                              this must be known to the PCI bus device too. If
     2734     *                              it's not associated with the PCI device, then
     2735     *                              any number up to UINT8_MAX is fine.
     2736     * @param   cb                  The size (in bytes) of the region.
     2737     * @param   fFlags              Reserved for future use, must be zero.
     2738     * @param   ppv                 Where to store the address of the ring-3 mapping
     2739     *                              of the memory.
     2740     * @param   pszDesc             Pointer to description string. This must not be
     2741     *                              freed.
    27202742     * @thread  EMT.
    27212743     */
     
    27292751     *
    27302752     * @returns VBox status code.
    2731      * @param   pDevIns         The device instance.
    2732      * @param   iRegion         The region number used during registration.
     2753     * @param   pDevIns             The device instance.
     2754     * @param   iRegion             The region number used during registration.
    27332755     * @thread  EMT.
    27342756     */
     
    27462768     *
    27472769     * @returns VBox status code.
    2748      * @param   pDevIns         The device instance.
    2749      * @param   iRegion         The region number used during registration.
    2750      * @param   GCPhys          The physical address to map it at.
     2770     * @param   pDevIns             The device instance.
     2771     * @param   iRegion             The region number used during registration.
     2772     * @param   GCPhys              The physical address to map it at.
    27512773     * @thread  EMT.
    27522774     */
     
    27572779     *
    27582780     * @returns VBox status code.
    2759      * @param   pDevIns         The device instance.
    2760      * @param   iRegion         The region number used during registration.
    2761      * @param   GCPhys          The physical address it's currently mapped at.
     2781     * @param   pDevIns             The device instance.
     2782     * @param   iRegion             The region number used during registration.
     2783     * @param   GCPhys              The physical address it's currently mapped at.
    27622784     * @thread  EMT.
    27632785     */
     
    27712793     *
    27722794     * @return VBox status code.
    2773      * @param   pDevIns         The device owning the MMIO2 memory.
    2774      * @param   iRegion         The region.
    2775      * @param   off             The offset into the region. Will be rounded down to closest page boundrary.
    2776      * @param   cb              The number of bytes to map. Will be rounded up to the closest page boundrary.
    2777      * @param   pszDesc         Mapping description.
    2778      * @param   pRCPtr          Where to store the RC address.
     2795     * @param   pDevIns             The device owning the MMIO2 memory.
     2796     * @param   iRegion             The region.
     2797     * @param   off                 The offset into the region. Will be rounded down
     2798     *                              to closest page boundrary.
     2799     * @param   cb                  The number of bytes to map. Will be rounded up
     2800     *                              to the closest page boundrary.
     2801     * @param   pszDesc             Mapping description.
     2802     * @param   pRCPtr              Where to store the RC address.
    27792803     */
    27802804    DECLR3CALLBACKMEMBER(int, pfnMMHyperMapMMIO2,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
     
    27882812     *
    27892813     * @return VBox status code.
    2790      * @param   pDevIns         The device owning the MMIO2 memory.
    2791      * @param   iRegion         The region.
    2792      * @param   off             The offset into the region. Must be page aligned.
    2793      * @param   cb              The number of bytes to map. Must be page aligned.
    2794      * @param   pszDesc         Mapping description.
    2795      * @param   pR0Ptr          Where to store the R0 address.
     2814     * @param   pDevIns             The device owning the MMIO2 memory.
     2815     * @param   iRegion             The region.
     2816     * @param   off                 The offset into the region. Must be page
     2817     *                              aligned.
     2818     * @param   cb                  The number of bytes to map. Must be page
     2819     *                              aligned.
     2820     * @param   pszDesc             Mapping description.
     2821     * @param   pR0Ptr              Where to store the R0 address.
    27962822     */
    27972823    DECLR3CALLBACKMEMBER(int, pfnMMIO2MapKernel,(PPDMDEVINS pDevIns, uint32_t iRegion, RTGCPHYS off, RTGCPHYS cb,
     
    28022828     *
    28032829     * @returns VBox status code.
    2804      * @param   pDevIns         The device instance.
    2805      * @param   GCPhys          The physical address.
    2806      * @param   pvHeap          Ring 3 heap pointer.
    2807      * @param   cbSize          Size of the heap.
     2830     * @param   pDevIns             The device instance.
     2831     * @param   GCPhys              The physical address.
     2832     * @param   pvHeap              Ring 3 heap pointer.
     2833     * @param   cbSize              Size of the heap.
    28082834     * @thread  EMT.
    28092835     */
     
    28142840     *
    28152841     * @returns VBox status code.
    2816      * @param   pDevIns         The device instance.
    2817      * @param   GCPhys          The physical address.
     2842     * @param   pDevIns             The device instance.
     2843     * @param   GCPhys              The physical address.
    28182844     * @thread  EMT.
    28192845     */
     
    33293355 * @copydoc PDMDEVHLPR3::pfnROMRegister
    33303356 */
    3331 DECLINLINE(int) PDMDevHlpROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc)
    3332 {
    3333     return pDevIns->pDevHlpR3->pfnROMRegister(pDevIns, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc);
     3357DECLINLINE(int) PDMDevHlpROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, uint32_t fFlags, const char *pszDesc)
     3358{
     3359    return pDevIns->pDevHlpR3->pfnROMRegister(pDevIns, GCPhysStart, cbRange, pvBinary, fFlags, pszDesc);
    33343360}
    33353361/**
  • trunk/include/VBox/pgm.h

    r18101 r18143  
    496496 * @{ */
    497497/** Inidicates that ROM shadowing should be enabled. */
    498 #define PGMPHYS_ROM_FLAG_SHADOWED           RT_BIT_32(0)
     498#define PGMPHYS_ROM_FLAGS_SHADOWED          RT_BIT_32(0)
    499499/** Indicates that what pvBinary points to won't go away
    500500 * and can be used for strictness checks. */
    501 #define PGMPHYS_ROM_FLAG_PERMANENT_BINARY   RT_BIT_32(1)
     501#define PGMPHYS_ROM_FLAGS_PERMANENT_BINARY  RT_BIT_32(1)
    502502/** @} */
    503503
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r18133 r18143  
    57805780    AssertReleaseMsg(RT_ALIGN_Z(g_cbVgaBiosBinary, PAGE_SIZE) == g_cbVgaBiosBinary, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary));
    57815781    rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, g_cbVgaBiosBinary, &g_abVgaBiosBinary[0],
    5782                               false /* fShadow */, "VGA BIOS");
     5782                              PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "VGA BIOS");
    57835783    if (RT_FAILURE(rc))
    57845784        return rc;
  • trunk/src/VBox/Devices/PC/DevACPI.cpp

    r17607 r18143  
    2525#define LOG_GROUP LOG_GROUP_DEV_ACPI
    2626#include <VBox/pdmdev.h>
     27#include <VBox/pgm.h>
    2728#include <VBox/log.h>
    2829#include <VBox/param.h>
     
    19151916        return rc;
    19161917
    1917     rc = PDMDevHlpROMRegister(pDevIns, rsdp_addr, 0x1000, s->au8RSDPPage, false /* fShadow */, "ACPI RSDP");
     1918    rc = PDMDevHlpROMRegister(pDevIns, rsdp_addr, 0x1000, s->au8RSDPPage,
     1919                              PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "ACPI RSDP");
    19181920    if (RT_FAILURE(rc))
    19191921        return rc;
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r17597 r18143  
    2626#include <VBox/pdmdev.h>
    2727#include <VBox/mm.h>
     28#include <VBox/pgm.h>
    2829
    2930#include <VBox/log.h>
     
    165166    /** The name of the LAN boot ROM file. */
    166167    char           *pszLanBootFile;
     168    /** The size of the LAN boot ROM. */
     169    uint64_t        cbLanBoot;
    167170    /** The DMI tables. */
    168171    uint8_t        au8DMIPage[0x1000];
     
    12211224    if (pThis->u8IOAPIC)
    12221225        pcbiosPlantMPStable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
     1226
     1227#ifdef VBOX_WITH_NEW_PHYS_CODE
     1228    /*
     1229     * Re-shadow the LAN ROM image and make it RAM/RAM.
     1230     *
     1231     * This is normally done by the BIOS code, but since we're currently lacking
     1232     * the chipset support for this we do it here (and in the constructor).
     1233     */
     1234    uint32_t    cPages = RT_ALIGN_64(pThis->cbLanBoot, PAGE_SIZE) >> PAGE_SHIFT;
     1235    RTGCPHYS    GCPhys = VBOX_LANBOOT_SEG << 4;
     1236    while (cPages > 0)
     1237    {
     1238        uint8_t abPage[PAGE_SIZE];
     1239        int     rc;
     1240
     1241        /* Read the (original) ROM page and write it back to the RAM page. */
     1242        rc = PDMDevHlpROMProtectShadow(pDevIns, GCPhys, PAGE_SIZE, PGMROMPROT_READ_ROM_WRITE_RAM);
     1243        AssertLogRelRC(rc);
     1244
     1245        rc = PDMDevHlpPhysRead(pDevIns, GCPhys, abPage, PAGE_SIZE);
     1246        AssertLogRelRC(rc);
     1247        if (RT_FAILURE(rc))
     1248            memset(abPage, 0xcc, sizeof(abPage));
     1249
     1250        rc = PDMDevHlpPhysWrite(pDevIns, GCPhys, abPage, PAGE_SIZE);
     1251        AssertLogRelRC(rc);
     1252
     1253        /* Switch to the RAM/RAM mode. */
     1254        rc = PDMDevHlpROMProtectShadow(pDevIns, GCPhys, PAGE_SIZE, PGMROMPROT_READ_RAM_WRITE_RAM);
     1255        AssertLogRelRC(rc);
     1256
     1257        /* Advance */
     1258        GCPhys += PAGE_SIZE;
     1259        cPages--;
     1260    }
     1261#endif
    12231262}
    12241263
     
    14741513        pcbiosPlantMPStable(pDevIns, pThis->au8DMIPage + VBOX_DMI_TABLE_SIZE, pThis->cCpus);
    14751514
    1476     rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage, false /* fShadow */, "DMI tables");
     1515    rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, _4K, pThis->au8DMIPage,
     1516                              PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "DMI tables");
    14771517    if (RT_FAILURE(rc))
    14781518        return rc;
     
    15701610
    15711611    /* If we were unable to get the data from file for whatever reason, fall
    1572      * back to the built-in ROM image.
    1573      */
     1612       back to the built-in ROM image. */
     1613    uint32_t fFlags = 0;
    15741614    if (pThis->pu8PcBios == NULL)
    15751615    {
    15761616        pu8PcBiosBinary = g_abPcBiosBinary;
    15771617        cbPcBiosBinary  = g_cbPcBiosBinary;
     1618        fFlags          = PGMPHYS_ROM_FLAGS_PERMANENT_BINARY;
    15781619    }
    15791620    else
     
    15951636    cb = RT_MIN(cbPcBiosBinary, 128 * _1K); /* Effectively either 64 or 128K. */
    15961637    rc = PDMDevHlpROMRegister(pDevIns, 0x00100000 - cb, cb, &pu8PcBiosBinary[cbPcBiosBinary - cb],
    1597                               false /* fShadow */, "PC BIOS - 0xfffff");
     1638                              fFlags, "PC BIOS - 0xfffff");
    15981639    if (RT_FAILURE(rc))
    15991640        return rc;
    16001641    rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-(int32_t)cbPcBiosBinary, cbPcBiosBinary, pu8PcBiosBinary,
    1601                               false /* fShadow */, "PC BIOS - 0xffffffff");
     1642                              fFlags, "PC BIOS - 0xffffffff");
    16021643    if (RT_FAILURE(rc))
    16031644        return rc;
     
    16081649     */
    16091650    AssertReleaseMsg(g_cbVmiBiosBinary == _4K, ("cbVmiBiosBinary=%#x\n", g_cbVmiBiosBinary));
    1610     rc = PDMDevHlpROMRegister(pDevIns, VBOX_VMI_BIOS_BASE, g_cbVmiBiosBinary, g_abVmiBiosBinary, false, "VMI BIOS");
     1651    rc = PDMDevHlpROMRegister(pDevIns, VBOX_VMI_BIOS_BASE, g_cbVmiBiosBinary, g_abVmiBiosBinary,
     1652                              PGMPHYS_ROM_FLAGS_PERMANENT_BINARY, "VMI BIOS");
    16111653    if (RT_FAILURE(rc))
    16121654        return rc;
     
    17211763     */
    17221764    if (pu8LanBootBinary)
     1765    {
     1766        pThis->cbLanBoot = cbLanBootBinary;
     1767
    17231768        rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, cbLanBootBinary, pu8LanBootBinary,
    1724                                   true /* fShadow */, "Net Boot ROM");
     1769                                  PGMPHYS_ROM_FLAGS_SHADOWED, "Net Boot ROM");
     1770#ifdef VBOX_WITH_NEW_PHYS_CODE
     1771        if (RT_SUCCESS(rc))
     1772        {
     1773            rc = PDMDevHlpROMProtectShadow(pDevIns, VBOX_LANBOOT_SEG << 4, cbLanBootBinary, PGMROMPROT_READ_RAM_WRITE_RAM);
     1774            AssertRCReturn(rc, rc);
     1775            rc = PDMDevHlpPhysWrite(pDevIns, VBOX_LANBOOT_SEG << 4, pu8LanBootBinary, cbLanBootBinary);
     1776            AssertRCReturn(rc, rc);
     1777        }
     1778#endif
     1779    }
    17251780
    17261781    rc = CFGMR3QueryU8Def(pCfgHandle, "DelayBoot", &pThis->uBootDelay, 0);
  • trunk/src/VBox/VMM/PDMDevHlp.cpp

    r18101 r18143  
    336336
    337337/** @copydoc PDMDEVHLPR3::pfnROMRegister */
    338 static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc)
     338static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, uint32_t fFlags, const char *pszDesc)
    339339{
    340340    PDMDEV_ASSERT_DEVINS(pDevIns);
    341341    VM_ASSERT_EMT(pDevIns->Internal.s.pVMR3);
    342     LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvBinary=%p fShadow=%RTbool pszDesc=%p:{%s}\n",
    343              pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc, pszDesc));
     342    LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%RGp cbRange=%#x pvBinary=%p fFlags=%#RX32 pszDesc=%p:{%s}\n",
     343             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, fFlags, pszDesc, pszDesc));
    344344
    345345#ifdef VBOX_WITH_NEW_PHYS_CODE
    346     uint32_t fFlags = 0;
    347     if (fShadow)
    348         fFlags |= PGMPHYS_ROM_FLAG_SHADOWED;
    349     /** @todo PGMPHYS_ROM_FLAG_PERMANENT_BINARY */
    350346    int rc = PGMR3PhysRomRegister(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvBinary, fFlags, pszDesc);
    351347#else
    352     int rc = MMR3PhysRomRegister(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc);
     348    int rc = MMR3PhysRomRegister(pDevIns->Internal.s.pVMR3, pDevIns, GCPhysStart, cbRange, pvBinary,
     349                                 !!(fFlags & PGMPHYS_ROM_FLAGS_SHADOWED), pszDesc);
    353350#endif
    354351
  • trunk/src/VBox/VMM/PGMInternal.h

    r18125 r18143  
    11221122    /** Alignment padding ensuring that aPages is sizeof(PGMROMPAGE) aligned. */
    11231123    uint32_t                            au32Alignemnt[HC_ARCH_BITS == 32 ? 7 : 3];
    1124     /** Pointer to the original bits when PGMPHYS_ROM_FLAG_PERMANENT_BINARY was specified.
     1124    /** Pointer to the original bits when PGMPHYS_ROM_FLAGS_PERMANENT_BINARY was specified.
    11251125     * This is used for strictness checks. */
    11261126    R3PTRTYPE(const void *)             pvOriginal;
     
    36463646    if (!pGuestPDPT)
    36473647        pGuestPDPT = pgmGstLazyMapPaePDPT(pPGM);
    3648 # endif 
     3648# endif
    36493649# endif
    36503650#endif
  • trunk/src/VBox/VMM/PGMPhys.cpp

    r18101 r18143  
    347347
    348348#ifdef VBOX_WITH_NEW_PHYS_CODE
    349 /** 
     349/**
    350350 * VMR3ReqCall worker for PGMR3PhysGCPhys2CCPtrExternal to make pages writable.
    351  * 
     351 *
    352352 * @returns see PGMR3PhysGCPhys2CCPtrExternal
    353353 * @param   pVM         The VM handle.
     
    355355 * @param   ppv         Where to store the mapping address.
    356356 * @param   pLock       Where to store the lock.
    357  */ 
     357 */
    358358static DECLCALLBACK(int) pgmR3PhysGCPhys2CCPtrDelegated(PVM pVM, PRTGCPHYS pGCPhys, void **ppv, PPGMPAGEMAPLOCK pLock)
    359359{
    360360    /*
    361      * Just hand it to PGMPhysGCPhys2CCPtr and check that it's not a page with 
     361     * Just hand it to PGMPhysGCPhys2CCPtr and check that it's not a page with
    362362     * an access handler after it succeeds.
    363363     */
     
    392392 * Requests the mapping of a guest page into ring-3, external threads.
    393393 *
    394  * When you're done with the page, call PGMPhysReleasePageMappingLock() ASAP to 
    395  * release it. 
    396  *
    397  * This API will assume your intention is to write to the page, and will 
    398  * therefore replace shared and zero pages. If you do not intend to modify the 
    399  * page, use the PGMR3PhysGCPhys2CCPtrReadOnlyExternal() API. 
     394 * When you're done with the page, call PGMPhysReleasePageMappingLock() ASAP to
     395 * release it.
     396 *
     397 * This API will assume your intention is to write to the page, and will
     398 * therefore replace shared and zero pages. If you do not intend to modify the
     399 * page, use the PGMR3PhysGCPhys2CCPtrReadOnlyExternal() API.
    400400 *
    401401 * @returns VBox status code.
    402402 * @retval  VINF_SUCCESS on success.
    403  * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical 
     403 * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical
    404404 *          backing or if the page has any active access handlers. The caller
    405405 *          must fall back on using PGMR3PhysWriteExternal.
     
    445445            /*
    446446             * If the page is shared, the zero page, or being write monitored
    447              * it must be converted to an page that's writable if possible. 
     447             * it must be converted to an page that's writable if possible.
    448448             * This has to be done on an EMT.
    449449             */
     
    451451            {
    452452                pgmUnlock(pVM);
    453    
     453
    454454                PVMREQ pReq = NULL;
    455455                rc = VMR3ReqCall(pVM, VMREQDEST_ANY, &pReq, RT_INDEFINITE_WAIT,
     
    496496/**
    497497 * Requests the mapping of a guest page into ring-3, external threads.
    498  * 
     498 *
    499499 * When you're done with the page, call PGMPhysReleasePageMappingLock() ASAP to
    500500 * release it.
     
    502502 * @returns VBox status code.
    503503 * @retval  VINF_SUCCESS on success.
    504  * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical 
     504 * @retval  VERR_PGM_PHYS_PAGE_RESERVED it it's a valid page but has no physical
    505505 *          backing or if the page as an active ALL access handler. The caller
    506506 *          must fall back on using PGMPhysRead.
     
    538538            rc = VERR_PGM_PHYS_PAGE_RESERVED;
    539539#endif
    540         else 
     540        else
    541541        {
    542542            /*
     
    16961696 * @param   pvBinary            Pointer to the binary data backing the ROM image.
    16971697 *                              This must be exactly \a cbRange in size.
    1698  * @param   fFlags              Mask of flags. PGMPHYS_ROM_FLAG_SHADOWED
    1699  *                              and/or PGMPHYS_ROM_FLAG_PERMANENT_BINARY.
     1698 * @param   fFlags              Mask of flags. PGMPHYS_ROM_FLAGS_SHADOWED
     1699 *                              and/or PGMPHYS_ROM_FLAGS_PERMANENT_BINARY.
    17001700 * @param   pszDesc             Pointer to description string. This must not be freed.
    17011701 *
     
    17201720    AssertPtrReturn(pvBinary, VERR_INVALID_PARAMETER);
    17211721    AssertPtrReturn(pszDesc, VERR_INVALID_POINTER);
    1722     AssertReturn(!(fFlags & ~(PGMPHYS_ROM_FLAG_SHADOWED | PGMPHYS_ROM_FLAG_PERMANENT_BINARY)), VERR_INVALID_PARAMETER);
     1722    AssertReturn(!(fFlags & ~(PGMPHYS_ROM_FLAGS_SHADOWED | PGMPHYS_ROM_FLAGS_PERMANENT_BINARY)), VERR_INVALID_PARAMETER);
    17231723    VM_ASSERT_STATE_RETURN(pVM, VMSTATE_CREATING, VERR_VM_INVALID_VM_STATE);
    17241724
     
    17941794     */
    17951795    uint32_t cExtraBaseCost = fRamExists ? cPages : 0;
    1796     if (fFlags & PGMPHYS_ROM_FLAG_SHADOWED)
     1796    if (fFlags & PGMPHYS_ROM_FLAGS_SHADOWED)
    17971797        cExtraBaseCost += cPages;
    17981798    if (cExtraBaseCost)
     
    18991899             * to PGM atm).
    19001900             */
    1901             if (fFlags & PGMPHYS_ROM_FLAG_SHADOWED)
     1901            if (fFlags & PGMPHYS_ROM_FLAGS_SHADOWED)
    19021902            {
    19031903                REMR3NotifyPhysRomRegister(pVM, GCPhys, cb, NULL, true /* fShadowed */);
    19041904                rc = PGMR3HandlerPhysicalRegister(pVM,
    1905                                                   fFlags & PGMPHYS_ROM_FLAG_SHADOWED
     1905                                                  fFlags & PGMPHYS_ROM_FLAGS_SHADOWED
    19061906                                                  ? PGMPHYSHANDLERTYPE_PHYSICAL_ALL
    19071907                                                  : PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
     
    19141914            {
    19151915                rc = PGMR3HandlerPhysicalRegister(pVM,
    1916                                                   fFlags & PGMPHYS_ROM_FLAG_SHADOWED
     1916                                                  fFlags & PGMPHYS_ROM_FLAGS_SHADOWED
    19171917                                                  ? PGMPHYSHANDLERTYPE_PHYSICAL_ALL
    19181918                                                  : PGMPHYSHANDLERTYPE_PHYSICAL_WRITE,
     
    19541954                    pRomNew->cb = cb;
    19551955                    pRomNew->fFlags = fFlags;
    1956                     pRomNew->pvOriginal = fFlags & PGMPHYS_ROM_FLAG_PERMANENT_BINARY ? pvBinary : NULL;
     1956                    pRomNew->pvOriginal = fFlags & PGMPHYS_ROM_FLAGS_PERMANENT_BINARY ? pvBinary : NULL;
    19571957                    pRomNew->pszDesc = pszDesc;
    19581958
     
    20372037    Assert(iPage < (pRom->cb >> PAGE_SHIFT));
    20382038    PPGMROMPAGE     pRomPage = &pRom->aPages[iPage];
    2039     switch (pRomPage->enmProt)
    2040     {
    2041         /*
    2042          * Ignore.
    2043          */
    2044         case PGMROMPROT_READ_ROM_WRITE_IGNORE:
    2045         case PGMROMPROT_READ_RAM_WRITE_IGNORE:
    2046             return VINF_SUCCESS;
    2047 
    2048         /*
    2049          * Write to the ram page.
    2050          */
    2051         case PGMROMPROT_READ_ROM_WRITE_RAM:
    2052         case PGMROMPROT_READ_RAM_WRITE_RAM: /* yes this will get here too, it's *way* simpler that way. */
    2053         {
    2054             /* This should be impossible now, pvPhys doesn't work cross page anylonger. */
    2055             Assert(((GCPhys - pRom->GCPhys + cbBuf - 1) >> PAGE_SHIFT) == iPage);
    2056 
     2039    Log5(("pgmR3PhysRomWriteHandler: %d %c %#08RGp %#04zx\n", pRomPage->enmProt, enmAccessType == PGMACCESSTYPE_READ ? 'R' : 'W', GCPhys, cbBuf));
     2040
     2041    if (enmAccessType == PGMACCESSTYPE_READ)
     2042    {
     2043        switch (pRomPage->enmProt)
     2044        {
    20572045            /*
    2058              * Take the lock, do lazy allocation, map the page and copy the data.
    2059              *
    2060              * Note that we have to bypass the mapping TLB since it works on
    2061              * guest physical addresses and entering the shadow page would
    2062              * kind of screw things up...
     2046             * Take the default action.
    20632047             */
    2064             int rc = pgmLock(pVM);
    2065             AssertRC(rc);
    2066 
    2067             if (RT_UNLIKELY(PGM_PAGE_GET_STATE(&pRomPage->Shadow) != PGM_PAGE_STATE_ALLOCATED))
     2048            case PGMROMPROT_READ_ROM_WRITE_IGNORE:
     2049            case PGMROMPROT_READ_RAM_WRITE_IGNORE:
     2050            case PGMROMPROT_READ_ROM_WRITE_RAM:
     2051            case PGMROMPROT_READ_RAM_WRITE_RAM:
     2052                return VINF_PGM_HANDLER_DO_DEFAULT;
     2053
     2054            default:
     2055                AssertMsgFailedReturn(("enmProt=%d iPage=%d GCPhys=%RGp\n",
     2056                                       pRom->aPages[iPage].enmProt, iPage, GCPhys),
     2057                                      VERR_INTERNAL_ERROR);
     2058        }
     2059    }
     2060    else
     2061    {
     2062        Assert(enmAccessType == PGMACCESSTYPE_WRITE);
     2063        switch (pRomPage->enmProt)
     2064        {
     2065            /*
     2066             * Ignore writes.
     2067             */
     2068            case PGMROMPROT_READ_ROM_WRITE_IGNORE:
     2069            case PGMROMPROT_READ_RAM_WRITE_IGNORE:
     2070                return VINF_SUCCESS;
     2071
     2072            /*
     2073             * Write to the ram page.
     2074             */
     2075            case PGMROMPROT_READ_ROM_WRITE_RAM:
     2076            case PGMROMPROT_READ_RAM_WRITE_RAM: /* yes this will get here too, it's *way* simpler that way. */
    20682077            {
    2069                 rc = pgmPhysPageMakeWritable(pVM, &pRomPage->Shadow, GCPhys);
    2070                 if (RT_FAILURE(rc))
     2078                /* This should be impossible now, pvPhys doesn't work cross page anylonger. */
     2079                Assert(((GCPhys - pRom->GCPhys + cbBuf - 1) >> PAGE_SHIFT) == iPage);
     2080
     2081                /*
     2082                 * Take the lock, do lazy allocation, map the page and copy the data.
     2083                 *
     2084                 * Note that we have to bypass the mapping TLB since it works on
     2085                 * guest physical addresses and entering the shadow page would
     2086                 * kind of screw things up...
     2087                 */
     2088                int rc = pgmLock(pVM);
     2089                AssertRC(rc);
     2090                PPGMPAGE pShadowPage = &pRomPage->Shadow;
     2091                if (!PGMROMPROT_IS_ROM(pRomPage->enmProt))
    20712092                {
    2072                     pgmUnlock(pVM);
    2073                     return rc;
     2093                    pShadowPage = pgmPhysGetPage(&pVM->pgm.s, GCPhys);
     2094                    AssertLogRelReturn(pShadowPage, VERR_INTERNAL_ERROR);
    20742095                }
    2075                 AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 /* returned */, ("%Rrc\n", rc));
     2096
     2097                if (RT_UNLIKELY(PGM_PAGE_GET_STATE(pShadowPage) != PGM_PAGE_STATE_ALLOCATED))
     2098                {
     2099                    rc = pgmPhysPageMakeWritable(pVM, pShadowPage, GCPhys);
     2100                    if (RT_FAILURE(rc))
     2101                    {
     2102                        pgmUnlock(pVM);
     2103                        return rc;
     2104                    }
     2105                    AssertMsg(rc == VINF_SUCCESS || rc == VINF_PGM_SYNC_CR3 /* returned */, ("%Rrc\n", rc));
     2106                }
     2107
     2108                void       *pvDstPage;
     2109                PPGMPAGEMAP pMapIgnored;
     2110                int rc2 = pgmPhysPageMap(pVM, pShadowPage, GCPhys & X86_PTE_PG_MASK, &pMapIgnored, &pvDstPage);
     2111                if (RT_SUCCESS(rc2))
     2112                    memcpy((uint8_t *)pvDstPage + (GCPhys & PAGE_OFFSET_MASK), pvBuf, cbBuf);
     2113                else
     2114                    rc = rc2;
     2115
     2116                pgmUnlock(pVM);
     2117                return rc;
    20762118            }
    20772119
    2078             void *pvDstPage;
    2079             PPGMPAGEMAP pMapIgnored;
    2080             int rc2 = pgmPhysPageMap(pVM, &pRomPage->Shadow, GCPhys & X86_PTE_PG_MASK, &pMapIgnored, &pvDstPage);
    2081             if (RT_SUCCESS(rc2))
    2082                 memcpy((uint8_t *)pvDstPage + (GCPhys & PAGE_OFFSET_MASK), pvBuf, cbBuf);
    2083             else
    2084                 rc = rc2;
    2085 
    2086             pgmUnlock(pVM);
    2087             return rc;
    2088         }
    2089 
    2090         default:
    2091             AssertMsgFailedReturn(("enmProt=%d iPage=%d GCPhys=%RGp\n",
    2092                                    pRom->aPages[iPage].enmProt, iPage, GCPhys),
    2093                                   VERR_INTERNAL_ERROR);
     2120            default:
     2121                AssertMsgFailedReturn(("enmProt=%d iPage=%d GCPhys=%RGp\n",
     2122                                       pRom->aPages[iPage].enmProt, iPage, GCPhys),
     2123                                      VERR_INTERNAL_ERROR);
     2124        }
    20942125    }
    20952126}
     
    21122143        const uint32_t cPages = pRom->cb >> PAGE_SHIFT;
    21132144
    2114         if (pRom->fFlags & PGMPHYS_ROM_FLAG_SHADOWED)
     2145        if (pRom->fFlags & PGMPHYS_ROM_FLAGS_SHADOWED)
    21152146        {
    21162147            /*
     
    22462277        if (    GCPhys     <= pRom->GCPhysLast
    22472278            &&  GCPhysLast >= pRom->GCPhys
    2248             &&  (pRom->fFlags & PGMPHYS_ROM_FLAG_SHADOWED))
     2279            &&  (pRom->fFlags & PGMPHYS_ROM_FLAGS_SHADOWED))
    22492280        {
    22502281            /*
     
    22542285            uint32_t const cPages = pRom->GCPhysLast <= GCPhysLast
    22552286                                  ? pRom->cb >> PAGE_SHIFT
    2256                                   : (GCPhysLast - pRom->GCPhys) >> PAGE_SHIFT;
     2287                                  : (GCPhysLast - pRom->GCPhys + 1) >> PAGE_SHIFT;
    22572288            for (uint32_t iPage = (GCPhys - pRom->GCPhys) >> PAGE_SHIFT;
    22582289                 iPage < cPages;
     
    22792310                    /** @todo preserve the volatile flags (handlers) when these have been moved out of HCPhys! */
    22802311                }
     2312                pRomPage->enmProt = enmProt;
    22812313            }
    22822314
  • trunk/src/VBox/VMM/VMMAll/PGMAllPhys.cpp

    r18125 r18143  
    115115            rc = PGMHandlerPhysicalPageTempOff(pVM, pRom->GCPhys, GCPhysFault & X86_PTE_PG_MASK);
    116116            AssertRC(rc);
    117             break; /** @todo Must restart the instruction, not use the interpreter! */
     117            break; /** @todo Must edit the shadow PT and restart the instruction, not use the interpreter! */
    118118
    119119        case PGMROMPROT_READ_ROM_WRITE_RAM:
     
    939939 * @param   ppv         Where to store the address corresponding to GCPhys.
    940940 * @param   pLock       Where to store the lock information that PGMPhysReleasePageMappingLock needs.
    941  * 
    942  * @remarks The caller is responsible for dealing with access handlers. 
    943  * @todo    Add an informational return code for pages with access handlers? 
    944  * 
     941 *
     942 * @remarks The caller is responsible for dealing with access handlers.
     943 * @todo    Add an informational return code for pages with access handlers?
     944 *
    945945 * @remark  Avoid calling this API from within critical sections (other than the
    946946 *          PGM one) because of the deadlock risk. External threads may need to
     
    10471047 * This API should only be used for very short term, as it will consume
    10481048 * scarse resources (R0 and GC) in the mapping cache. When you're done
    1049  * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it. 
    1050  * 
     1049 * with the page, call PGMPhysReleasePageMappingLock() ASAP to release it.
     1050 *
    10511051 * @returns VBox status code.
    10521052 * @retval  VINF_SUCCESS on success.
     
    10591059 * @param   pLock       Where to store the lock information that PGMPhysReleasePageMappingLock needs.
    10601060 *
    1061  * @remarks The caller is responsible for dealing with access handlers. 
    1062  * @todo    Add an informational return code for pages with access handlers? 
    1063  * 
     1061 * @remarks The caller is responsible for dealing with access handlers.
     1062 * @todo    Add an informational return code for pages with access handlers?
     1063 *
    10641064 * @remark  Avoid calling this API from within critical sections (other than
    10651065 *          the PGM one) because of the deadlock risk.
     
    11091109        if (RT_UNLIKELY(PGM_PAGE_IS_MMIO(pPage)))
    11101110            rc = VERR_PGM_PHYS_PAGE_RESERVED;
    1111         else 
     1111        else
    11121112        {
    11131113            /*
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette