VirtualBox

Changeset 17542 in vbox for trunk/src


Ignore:
Timestamp:
Mar 8, 2009 8:52:07 AM (16 years ago)
Author:
vboxsync
Message:

Main,VBoxBFE,DevPcBios,DevACPI: RamHoleSize.

Location:
trunk/src/VBox
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/PC/DevACPI.cpp

    r17540 r17542  
    2323#include <VBox/pdmdev.h>
    2424#include <VBox/log.h>
     25#include <VBox/param.h>
    2526#include <iprt/assert.h>
    2627#include <iprt/asm.h>
     
    567568
    568569/* Simple acpiChecksum: all the bytes must add up to 0. */
    569 static uint8_t acpiChecksum (const uint8_t * const data, uint32_t len)
     570static uint8_t acpiChecksum (const uint8_t * const data, size_t len)
    570571{
    571572    uint8_t sum = 0;
     
    706707        return PDMDEV_SET_ERROR(s->pDevIns, VERR_NO_TMP_MEMORY, N_("Cannot allocate RSDT"));
    707708
    708     acpiPrepareHeader (&rsdt->header, "RSDT", size, 1);
     709    acpiPrepareHeader (&rsdt->header, "RSDT", (uint32_t)size, 1);
    709710    for (unsigned int i = 0; i < nb_entries; ++i)
    710711    {
     
    728729        return VERR_NO_TMP_MEMORY;
    729730
    730     acpiPrepareHeader (&xsdt->header, "XSDT", size, 1 /* according to ACPI 3.0 specs */);
     731    acpiPrepareHeader (&xsdt->header, "XSDT", (uint32_t)size, 1 /* according to ACPI 3.0 specs */);
    731732    for (unsigned int i = 0; i < nb_entries; ++i)
    732733    {
     
    17231724                                   "\"RamSize\" as integer failed"));
    17241725
    1725 #if 1 /** @todo 4GB: This needs fixing! (disable to test lots of memory) */
     1726    uint32_t cbRamHole;
     1727    rc = CFGMR3QueryU32Def (s->pDevIns->pCfgHandle, "RamHoleSize", &cbRamHole, MM_RAM_HOLE_SIZE_DEFAULT);
     1728    if (RT_FAILURE (rc))
     1729        return PDMDEV_SET_ERROR (s->pDevIns, rc,
     1730                                 N_ ("Configuration error: Querying \"RamHoleSize\" as integer failed"));
     1731    const uint64_t offRamHole = _4G - cbRamHole;
     1732
     1733#if 0 /** @todo 4GB: This needs adjusting fixing! I've disabled it to test big mem configs. */
    17261734    if (s->u64RamSize > (0xffffffff - 0x10000))
    17271735        return PDMDEV_SET_ERROR(s->pDevIns, VERR_OUT_OF_RANGE,
     
    17581766
    17591767    Log(("RSDP 0x%08X\n", find_rsdp_space()));
     1768#if 1 /** @todo 4GB: Quick hack, may need revising. */
     1769    addend = (uint32_t) RT_MIN (s->u64RamSize, offRamHole) - 0x10000;
     1770#else
    17601771    addend = (uint32_t) s->u64RamSize - 0x10000;
     1772#endif
    17611773    Log(("RSDT 0x%08X XSDT 0x%08X\n", rsdt_addr + addend, xsdt_addr + addend));
    17621774    Log(("FACS 0x%08X FADT 0x%08X\n", facs_addr + addend, fadt_addr + addend));
     
    18051817    if (!CFGMR3AreValuesValid (pCfgHandle,
    18061818                               "RamSize\0"
     1819                               "RamHoleSize\0"
    18071820                               "IOAPIC\0"
    18081821                               "NumCPUs\0"
  • trunk/src/VBox/Devices/PC/DevPcBios.cpp

    r15366 r17542  
    137137    /** Boot devices (ordered). */
    138138    DEVPCBIOSBOOT   aenmBootDevice[4];
    139     /** Ram Size (in bytes). */
     139    /** RAM size (in bytes). */
    140140    uint64_t        cbRam;
     141    /** RAM hole size (in bytes). */
     142    uint32_t        cbRamHole;
    141143    /** Bochs shutdown index. */
    142144    uint32_t        iShutdown;
     
    581583    pcbiosCmosWrite(pDevIns, 0x31, u32 >> 8);                                   /* 31h - Extended Memory in K, High Byte */
    582584
    583     /* Bochs BIOS specific? Anyway, it's the amount of memory above 16MB */
     585    /* Bochs BIOS specific? Anyway, it's the amount of memory above 16MB
     586       and below 4GB (as it can only hold 4GB+16M). */
     587    uint64_t const offRamHole = _4G - pThis->cbRamHole;
    584588    if (pThis->cbRam > 16 * _1M)
    585589    {
    586         u32 = (uint32_t)( (pThis->cbRam - 16 * _1M) / _64K );
     590        u32 = (uint32_t)( (RT_MIN(pThis->cbRam, offRamHole) - 16 * _1M) / _64K );
    587591        u32 = RT_MIN(u32, 0xffff);
    588592    }
     
    591595    pcbiosCmosWrite(pDevIns, 0x34, u32 & 0xff);
    592596    pcbiosCmosWrite(pDevIns, 0x35, u32 >> 8);
     597
     598# if 0    /** @todo Report the amount above 4GB and make sure the BIOS is only using 34/35 for the bits below 4GB. */
     599    /* Suggestion: MBs above 4GB, reserve 4 CMOS entries (need 3 now), means a
     600                   total around 2**52 bytes or 4EB if you like. The max of what
     601                   AMD64 is currently specified for IIRC.  */
     602    if (pThis->cbRam <= offRamHole)
     603        u32 = 0;
     604    else
     605    {
     606        u32 = (pThis->cbRam - offRamHole) / _1M;
     607        AssertMsg((uint64_t)u32 * _1M + offRamHole == pThis->cbRam, ("%RX64 %RX64\n", pThis->cbRam, offRamHole));
     608    }
     609    pcbiosCmosWrite(pDevIns, 0xY0,  u32        & 0xff);
     610    pcbiosCmosWrite(pDevIns, 0xY1, (u32 >>  8) & 0xff);
     611    pcbiosCmosWrite(pDevIns, 0xY2, (u32 >> 16) & 0xff);
     612    pcbiosCmosWrite(pDevIns, 0xY3,  u32 >> 24);
     613# endif
    593614#endif /* old code */
    594615
     
    13601381                              "BootDevice3\0"
    13611382                              "RamSize\0"
     1383                              "RamHoleSize\0"
    13621384                              "HardDiskDevice\0"
    13631385                              "SataHardDiskDevice\0"
     
    13981420                                N_("Configuration error: Querying \"RamSize\" as integer failed"));
    13991421
     1422    rc = CFGMR3QueryU32Def(pCfgHandle, "RamHoleSize", &pThis->cbRamHole, MM_RAM_HOLE_SIZE_DEFAULT);
     1423    if (RT_FAILURE(rc))
     1424        return PDMDEV_SET_ERROR(pDevIns, rc,
     1425                                N_("Configuration error: Querying \"RamHoleSize\" as integer failed"));
     1426
    14001427    rc = CFGMR3QueryU16Def(pCfgHandle, "NumCPUs", &pThis->cCpus, 1);
    14011428    if (RT_FAILURE(rc))
     
    14041431
    14051432#ifdef VBOX_WITH_SMP_GUESTS
    1406     LogRel(("[SMP] BIOS with %d CPUs\n", pThis->cCpus));
     1433    LogRel(("[SMP] BIOS with %u CPUs\n", pThis->cCpus));
    14071434#else
    1408     /* @todo: move this check up in configuration chain */
     1435    /** @todo: move this check up in configuration chain */
    14091436    if (pThis->cCpus != 1)
    14101437    {
  • trunk/src/VBox/Frontends/VBoxBFE/VBoxBFE.cpp

    r16646 r17542  
    13861386    rc = CFGMR3InsertString(pRoot,  "Name",           "Default VM");                UPDATE_RC();
    13871387    rc = CFGMR3InsertInteger(pRoot, "RamSize",        g_u32MemorySizeMB * _1M);     UPDATE_RC();
     1388    rc = CFGMR3InsertInteger(pRoot, "RamHoleSize",    512U * _1M);                  UPDATE_RC();
    13881389    if (g_fPreAllocRam)
    13891390    {
     
    14371438    rc = CFGMR3InsertNode(pInst,    "Config",         &pCfg);                       UPDATE_RC();
    14381439    rc = CFGMR3InsertInteger(pCfg,  "RamSize",        g_u32MemorySizeMB * _1M);     UPDATE_RC();
     1440    rc = CFGMR3InsertInteger(pCfg,  "RamHoleSize",    512U * _1M);                  UPDATE_RC();
    14391441    rc = CFGMR3InsertString(pCfg,   "BootDevice0",    g_pszBootDevice);             UPDATE_RC();
    14401442    rc = CFGMR3InsertString(pCfg,   "BootDevice1",    "NONE");                      UPDATE_RC();
     
    14581460        rc = CFGMR3InsertNode(pInst,    "Config",         &pCfg);                   UPDATE_RC();
    14591461        rc = CFGMR3InsertInteger(pCfg,  "RamSize",        g_u32MemorySizeMB * _1M); UPDATE_RC();
     1462        rc = CFGMR3InsertInteger(pCfg,  "RamHoleSize",    512U * _1M);              UPDATE_RC();
    14601463        rc = CFGMR3InsertInteger(pCfg,  "IOAPIC",         g_fIOAPIC);               UPDATE_RC();
    14611464        rc = CFGMR3InsertInteger(pInst, "PCIDeviceNo",    7);                       UPDATE_RC();
  • trunk/src/VBox/Main/ConsoleImpl2.cpp

    r17539 r17542  
    8080#endif
    8181
     82#include <VBox/param.h>
     83
     84
    8285/**
    8386 * Translate IDEControllerType_T to string representation.
    8487 */
    85 const char* controllerString(IDEControllerType_T enmType)
     88const char *controllerString(IDEControllerType_T enmType)
    8689{
    8790    switch (enmType)
     
    97100    }
    98101}
     102
    99103/*
    100104 * VC++ 8 / amd64 has some serious trouble with this function.
     
    184188#endif
    185189    uint64_t const cbRam = cRamMBs * (uint64_t)_1M;
     190    uint32_t const cbRamHole = MM_RAM_HOLE_SIZE_DEFAULT;
    186191
    187192    ULONG cCpus = 1;
     
    206211    rc = CFGMR3InsertBytes(pRoot,   "UUID", pUuid, sizeof(*pUuid));                 RC_CHECK();
    207212    rc = CFGMR3InsertInteger(pRoot, "RamSize",              cbRam);                 RC_CHECK();
     213    rc = CFGMR3InsertInteger(pRoot, "RamHoleSize",          cbRamHole);             RC_CHECK();
    208214    rc = CFGMR3InsertInteger(pRoot, "NumCPUs",              cCpus);                 RC_CHECK();
    209215    rc = CFGMR3InsertInteger(pRoot, "TimerMillies",         10);                    RC_CHECK();
     
    367373        rc = CFGMR3InsertNode(pInst,    "Config", &pBiosCfg);                           RC_CHECK();
    368374        rc = CFGMR3InsertInteger(pBiosCfg,  "RamSize",              cbRam);             RC_CHECK();
     375        rc = CFGMR3InsertInteger(pBiosCfg,  "RamHoleSize",          cbRamHole);         RC_CHECK();
    369376        rc = CFGMR3InsertInteger(pBiosCfg,  "NumCPUs",              cCpus);             RC_CHECK();
    370377        rc = CFGMR3InsertString(pBiosCfg,   "HardDiskDevice",       "piix3ide");        RC_CHECK();
     
    631638        rc = CFGMR3InsertNode(pInst,    "Config", &pCfg);                           RC_CHECK();
    632639        rc = CFGMR3InsertInteger(pCfg,  "RamSize",          cbRam);                 RC_CHECK();
     640        rc = CFGMR3InsertInteger(pCfg,  "RamHoleSize",      cbRamHole);             RC_CHECK();
    633641        rc = CFGMR3InsertInteger(pCfg,  "NumCPUs",          cCpus);                 RC_CHECK();
    634642
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