VirtualBox

Changeset 4382 in vbox for trunk


Ignore:
Timestamp:
Aug 27, 2007 11:28:55 AM (17 years ago)
Author:
vboxsync
Message:

Extended the ROMRegister DevHlp interface to include a fShadow flag. Added a interface intented for write proecting shadow ROM after the POST is over.

Location:
trunk
Files:
5 edited

Legend:

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

    r4071 r4382  
    17911791     * @param   pvBinary            Pointer to the binary data backing the ROM image.
    17921792     *                              This must be cbRange bytes big.
    1793      *                              It will be copied and doesn't have to stick around.
     1793     *                              It will be copied and doesn't have to stick around if fShadow is clear.
     1794     * @param   fShadow             Whether to emulate ROM shadowing. This involves leaving
     1795     *                              the ROM writable for a while during the POST and refreshing
     1796     *                              it at reset. When this flag is set, the memory pointed to by
     1797     *                              pvBinary has to stick around for the lifespan of the VM.
    17941798     * @param   pszDesc             Pointer to description string. This must not be freed.
     1799     *
    17951800     * @remark  There is no way to remove the rom, automatically on device cleanup or
    17961801     *          manually from the device yet. At present I doubt we need such features...
    17971802     */
    1798     DECLR3CALLBACKMEMBER(int, pfnROMRegister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, const char *pszDesc));
     1803    DECLR3CALLBACKMEMBER(int, pfnROMRegister,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc));
    17991804
    18001805    /**
     
    25272532    DECLR3CALLBACKMEMBER(void, pfnGetCpuId,(PPDMDEVINS pDevIns, uint32_t iLeaf, uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx));
    25282533
     2534    /**
     2535     * Write protects a shadow ROM mapping.
     2536     *
     2537     * This is intented for use by the system BIOS or by the device that
     2538     * employs a shadow ROM BIOS, so that the shadow ROM mapping can be
     2539     * write protected once the POST is over.
     2540     *
     2541     * @param   pDevIns     Device instance.
     2542     * @param   GCPhysStart Where the shadow ROM mapping starts.
     2543     * @param   cbRange     The size of the shadow ROM mapping.
     2544     */
     2545    DECLR3CALLBACKMEMBER(int, pfnROMProtectShadow,(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange));
     2546
    25292547    /** @} */
    25302548
    2531     /** Just a safety precaution. (The value is 0.) */
     2549    /** Just a safety precaution. (PDM_DEVHLP_VERSION) */
    25322550    uint32_t                        u32TheEnd;
    25332551} PDMDEVHLP;
     
    25392557
    25402558/** Current PDMDEVHLP version number. */
    2541 #define PDM_DEVHLP_VERSION  0xf2040000
     2559#define PDM_DEVHLP_VERSION  0xf2050000
    25422560
    25432561
     
    29983016 * @copydoc PDMDEVHLP::pfnROMRegister
    29993017 */
    3000 DECLINLINE(int) PDMDevHlpROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, const char *pszDesc)
    3001 {
    3002     return pDevIns->pDevHlp->pfnROMRegister(pDevIns, GCPhysStart, cbRange, pvBinary, pszDesc);
     3018DECLINLINE(int) PDMDevHlpROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc)
     3019{
     3020    return pDevIns->pDevHlp->pfnROMRegister(pDevIns, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc);
     3021}
     3022
     3023/**
     3024 * @copydoc PDMDEVHLP::pfnROMProtectShadow
     3025 */
     3026DECLINLINE(int) PDMDevHlpROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange)
     3027{
     3028    return pDevIns->pDevHlp->pfnROMProtectShadow(pDevIns, GCPhysStart, cbRange);
    30033029}
    30043030
  • trunk/src/VBox/Devices/Graphics/DevVGA.cpp

    r4333 r4382  
    47354735    AssertReleaseMsg(g_cbVgaBiosBinary <= _64K && g_cbVgaBiosBinary >= 32*_1K, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary));
    47364736    AssertReleaseMsg(RT_ALIGN_Z(g_cbVgaBiosBinary, PAGE_SIZE) == g_cbVgaBiosBinary, ("g_cbVgaBiosBinary=%#x\n", g_cbVgaBiosBinary));
    4737     rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, g_cbVgaBiosBinary, &g_abVgaBiosBinary[0], "VGA BIOS");
     4737    rc = PDMDevHlpROMRegister(pDevIns, 0x000c0000, g_cbVgaBiosBinary, &g_abVgaBiosBinary[0],
     4738                              false /* fShadow */, "VGA BIOS");
    47384739    if (VBOX_FAILURE(rc))
    47394740        return rc;
  • trunk/src/VBox/Devices/PC/DevACPI.cpp

    r4279 r4382  
    15611561        return rc;
    15621562
    1563     rc = PDMDevHlpROMRegister (pDevIns, rsdp_addr, 0x1000, s->au8RSDPPage, "ACPI RSDP");
     1563    rc = PDMDevHlpROMRegister (pDevIns, rsdp_addr, 0x1000, s->au8RSDPPage, false /* fShadow */, "ACPI RSDP");
    15641564    if (VBOX_FAILURE (rc))
    15651565        return rc;
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r4071 r4382  
    11461146        pcbiosPlantMPStable(pDevIns, pData->au8DMIPage + 0x100);
    11471147
    1148     rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, 0x1000, pData->au8DMIPage, "DMI tables");
     1148    rc = PDMDevHlpROMRegister(pDevIns, VBOX_DMI_TABLE_BASE, 0x1000, pData->au8DMIPage, false /* fShadow */, "DMI tables");
    11491149    if (VBOX_FAILURE(rc))
    11501150        return rc;
     
    11611161                     ("g_cbPcBiosBinary=%#x\n", g_cbPcBiosBinary));
    11621162    cb = RT_MIN(g_cbPcBiosBinary, 128 * _1K);
    1163     rc = PDMDevHlpROMRegister(pDevIns, 0x00100000 - cb, cb,
    1164                               &g_abPcBiosBinary[g_cbPcBiosBinary - cb], "PC BIOS - 0xfffff");
     1163    rc = PDMDevHlpROMRegister(pDevIns, 0x00100000 - cb, cb, &g_abPcBiosBinary[g_cbPcBiosBinary - cb],
     1164                              false /* fShadow */, "PC BIOS - 0xfffff");
    11651165    if (VBOX_FAILURE(rc))
    11661166        return rc;
    1167     rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-g_cbPcBiosBinary, g_cbPcBiosBinary,
    1168                               &g_abPcBiosBinary[0], "PC BIOS - 0xffffffff");
     1167    rc = PDMDevHlpROMRegister(pDevIns, (uint32_t)-g_cbPcBiosBinary, g_cbPcBiosBinary, &g_abPcBiosBinary[0],
     1168                              false /* fShadow */, "PC BIOS - 0xffffffff");
    11691169    if (VBOX_FAILURE(rc))
    11701170        return rc;
     
    13991399     */
    14001400    if (pu8LanBoot)
    1401         rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, cbFileLanBoot, pu8LanBoot, "Net Boot ROM");
     1401        rc = PDMDevHlpROMRegister(pDevIns, VBOX_LANBOOT_SEG << 4, cbFileLanBoot, pu8LanBoot,
     1402                                  false /* fShadow */, "Net Boot ROM");
    14021403
    14031404    rc = CFGMR3QueryU8(pCfgHandle, "DelayBoot", &pData->uBootDelay);
  • trunk/src/VBox/VMM/PDMDevice.cpp

    r4071 r4382  
    9696                                           const char *pszDesc);
    9797static DECLCALLBACK(int) pdmR3DevHlp_MMIODeregister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange);
    98 static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, const char *pszDesc);
     98static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc);
    9999static DECLCALLBACK(int) pdmR3DevHlp_SSMRegister(PPDMDEVINS pDevIns, const char *pszName, uint32_t u32Instance, uint32_t u32Version, size_t cbGuess,
    100100                                        PFNSSMDEVSAVEPREP pfnSavePrep, PFNSSMDEVSAVEEXEC pfnSaveExec, PFNSSMDEVSAVEDONE pfnSaveDone,
     
    163163static DECLCALLBACK(void) pdmR3DevHlp_GetCpuId(PPDMDEVINS pDevIns, uint32_t iLeaf,
    164164                                               uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx);
     165static DECLCALLBACK(int) pdmR3DevHlp_ROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange);
    165166
    166167static DECLCALLBACK(PVM) pdmR3DevHlp_Untrusted_GetVM(PPDMDEVINS pDevIns);
     
    195196static DECLCALLBACK(void) pdmR3DevHlp_Untrusted_QueryCPUId(PPDMDEVINS pDevIns, uint32_t iLeaf,
    196197                                                           uint32_t *pEax, uint32_t *pEbx, uint32_t *pEcx, uint32_t *pEdx);
    197 
     198static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_ROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange);
    198199/** @} */
    199200
     
    358359    pdmR3DevHlp_CMOSRead,
    359360    pdmR3DevHlp_GetCpuId,
     361    pdmR3DevHlp_ROMProtectShadow,
    360362    PDM_DEVHLP_VERSION /* the end */
    361363};
     
    446448    pdmR3DevHlp_Untrusted_CMOSRead,
    447449    pdmR3DevHlp_Untrusted_QueryCPUId,
     450    pdmR3DevHlp_Untrusted_ROMProtectShadow,
    448451    PDM_DEVHLP_VERSION /* the end */
    449452};
     
    14781481
    14791482/** @copydoc PDMDEVHLP::pfnROMRegister */
    1480 static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, const char *pszDesc)
     1483static DECLCALLBACK(int) pdmR3DevHlp_ROMRegister(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange, const void *pvBinary, bool fShadow, const char *pszDesc)
    14811484{
    14821485    PDMDEV_ASSERT_DEVINS(pDevIns);
    14831486    VM_ASSERT_EMT(pDevIns->Internal.s.pVMHC);
    1484     LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%VGp cbRange=%#x pvBinary=%p pszDesc=%p:{%s}\n",
    1485              pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, pszDesc, pszDesc));
    1486 
     1487    LogFlow(("pdmR3DevHlp_ROMRegister: caller='%s'/%d: GCPhysStart=%VGp cbRange=%#x pvBinary=%p fShadow=%RTbool pszDesc=%p:{%s}\n",
     1488             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange, pvBinary, fShadow, pszDesc, pszDesc));
     1489
     1490AssertReturn(!fShadow, VERR_NOT_IMPLEMENTED); /* be patient. */
    14871491    int rc = MMR3PhysRomRegister(pDevIns->Internal.s.pVMHC, pDevIns, GCPhysStart, cbRange, pvBinary, pszDesc);
    14881492
     
    35873591
    35883592
     3593/** @copydoc PDMDEVHLP::pfnROMProtectShadow */
     3594static DECLCALLBACK(int) pdmR3DevHlp_ROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange)
     3595{
     3596    PDMDEV_ASSERT_DEVINS(pDevIns);
     3597    LogFlow(("pdmR3DevHlp_ROMProtectShadow: caller='%s'/%d: GCPhysStart=%VGp cbRange=%#x\n",
     3598             pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, GCPhysStart, cbRange));
     3599
     3600AssertFailed(); /* be patient. */
     3601    int rc = VERR_NOT_IMPLEMENTED;
     3602
     3603    LogFlow(("pdmR3DevHlp_ROMProtectShadow: caller='%s'/%d: returns %Vrc\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance, rc));
     3604    return rc;
     3605}
     3606
    35893607
    35903608
     
    38863904    PDMDEV_ASSERT_DEVINS(pDevIns);
    38873905    AssertReleaseMsgFailed(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
     3906}
     3907
     3908
     3909/** @copydoc PDMDEVHLP::pfnROMProtectShadow */
     3910static DECLCALLBACK(int) pdmR3DevHlp_Untrusted_ROMProtectShadow(PPDMDEVINS pDevIns, RTGCPHYS GCPhysStart, RTUINT cbRange)
     3911{
     3912    PDMDEV_ASSERT_DEVINS(pDevIns);
     3913    AssertReleaseMsgFailed(("Untrusted device called trusted helper! '%s'/%d\n", pDevIns->pDevReg->szDeviceName, pDevIns->iInstance));
     3914    return VERR_ACCESS_DENIED;
    38883915}
    38893916
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