VirtualBox

Changeset 3393 in vbox for trunk


Ignore:
Timestamp:
Jul 3, 2007 3:36:47 PM (17 years ago)
Author:
vboxsync
Message:

Removed PCSUPGLOBALINFOPAGE and PCSUPGIPCPU to avoid const/volatile confusion.

Location:
trunk
Files:
9 edited

Legend:

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

    r3363 r3393  
    3333 */
    3434
    35 /** 
     35/**
    3636 * Physical page descriptor.
    3737 */
     
    8585/**
    8686 * Per CPU data.
    87  * This is only used when 
     87 * This is only used when
    8888 */
    8989typedef struct SUPGIPCPU
     
    122122/*AssertCompileMemberAlignment(SUPGIPCPU, u64TSC, 8); -fixme */
    123123
    124 /** Pointer to per cpu data. */
     124/** Pointer to per cpu data.
     125 * @remark there is no const version of this typedef, see g_pSUPGlobalInfoPage for details. */
    125126typedef SUPGIPCPU *PSUPGIPCPU;
    126 /** Pointer to const per cpu data. */
    127 typedef const SUPGIPCPU *PCSUPGIPCPU;
    128127
    129128/**
     
    164163/* AssertCompileMemberAlignment(SUPGLOBALINFOPAGE, aCPU, 32); - fixme */
    165164
    166 /** Pointer to the global info page. */
     165/** Pointer to the global info page.
     166 * @remark there is no const version of this typedef, see g_pSUPGlobalInfoPage for details. */
    167167typedef SUPGLOBALINFOPAGE *PSUPGLOBALINFOPAGE;
    168 /** Const pointer to the global info page. */
    169 typedef const SUPGLOBALINFOPAGE *PCSUPGLOBALINFOPAGE;
    170168
    171169#pragma pack() /* end of paranoia */
     
    173171/** The value of the SUPGLOBALINFOPAGE::u32Magic field. (Soryo Fuyumi) */
    174172#define SUPGLOBALINFOPAGE_MAGIC     0x19590106
    175 /** The GIP version. 
    176  * Upper 16 bits is the major version. Major version is only changed with 
     173/** The GIP version.
     174 * Upper 16 bits is the major version. Major version is only changed with
    177175 * incompatible changes in the GIP. */
    178176#define SUPGLOBALINFOPAGE_VERSION   0x00020000
    179177
    180 /** 
     178/**
    181179 * SUPGLOBALINFOPAGE::u32Mode values.
    182180 */
     
    198196 * the page must treat this pointer as higly volatile and not trust it beyond
    199197 * one transaction.
     198 *
     199 * @remark  The GIP page is read-only to everyone but the support driver and
     200 *          is actually mapped read only everywhere but in ring-0. However
     201 *          it is not marked 'const' as this might confuse compilers into
     202 *          thinking that values doesn't change even if members are marked
     203 *          as volatile. Thus, there is no PCSUPGLOBALINFOPAGE type.
    200204 */
    201205#if defined(IN_SUP_R0) || defined(IN_SUP_R3) || defined(IN_SUP_GC)
    202 extern DECLEXPORT(PCSUPGLOBALINFOPAGE)  g_pSUPGlobalInfoPage;
     206extern DECLEXPORT(PSUPGLOBALINFOPAGE)   g_pSUPGlobalInfoPage;
    203207#elif defined(IN_RING0)
    204 extern DECLIMPORT(const SUPGLOBALINFOPAGE) g_SUPGlobalInfoPage;
     208extern DECLIMPORT(SUPGLOBALINFOPAGE)    g_SUPGlobalInfoPage;
    205209# if defined(__GNUC__) && !defined(__DARWIN__) && defined(__AMD64__)
    206210/** Workaround for ELF+GCC problem on 64-bit hosts.
    207211 * (GCC emits a mov with a R_X86_64_32 reloc, we need R_X86_64_64.) */
    208 DECLINLINE(PCSUPGLOBALINFOPAGE) SUPGetGIP(void)
    209 {
    210     PCSUPGLOBALINFOPAGE pGIP;
     212DECLINLINE(PSUPGLOBALINFOPAGE) SUPGetGIP(void)
     213{
     214    PSUPGLOBALINFOPAGE pGIP;
    211215    __asm__ __volatile__ ("movabs $g_SUPGlobalInfoPage,%0\n\t"
    212216                          : "=a" (pGIP));
    213217    return pGIP;
    214218}
    215 #  define g_pSUPGlobalInfoPage         (SUPGetGIP())
    216 # elif defined(__GNUC__) && !defined(__DARWIN__)
    217 /** gcc optimizes &g_SUPGlobalInfoPage + offset */
    218 DECLINLINE(PCSUPGLOBALINFOPAGE) SUPGetGIP(void)
    219 {
    220     PCSUPGLOBALINFOPAGE pGIP;
    221     __asm__ __volatile__ ("movl $g_SUPGlobalInfoPage,%0\n\t"
    222                           : "=a" (pGIP));
    223     return pGIP;
    224 }
    225 #  define g_pSUPGlobalInfoPage         (SUPGetGIP())
     219#  define g_pSUPGlobalInfoPage          (SUPGetGIP())
    226220# else
    227 #  define g_pSUPGlobalInfoPage         (&g_SUPGlobalInfoPage)
     221#  define g_pSUPGlobalInfoPage          (&g_SUPGlobalInfoPage)
    228222# endif
    229223#else
    230 extern DECLIMPORT(PCSUPGLOBALINFOPAGE)  g_pSUPGlobalInfoPage;
     224extern DECLIMPORT(PSUPGLOBALINFOPAGE)   g_pSUPGlobalInfoPage;
    231225#endif
    232226
     
    234228/**
    235229 * Gets the TSC frequency of the calling CPU.
    236  * 
     230 *
    237231 * @returns TSC frequency.
    238232 * @param   pGip        The GIP pointer.
    239233 */
    240 DECLINLINE(uint64_t) SUPGetCpuHzFromGIP(PCSUPGLOBALINFOPAGE pGip)
     234DECLINLINE(uint64_t) SUPGetCpuHzFromGIP(PSUPGLOBALINFOPAGE pGip)
    241235{
    242236    unsigned iCpu;
     
    581575__END_DECLS
    582576
    583 
    584577#endif
    585578
  • trunk/src/VBox/HostDrivers/Support/SUPDRV.h

    r3189 r3393  
    545545    /** The read-only usermode mapping address of the GID.
    546546     * This is NULL if the GIP hasn't been mapped. */
    547     PCSUPGLOBALINFOPAGE         pGip;
     547    PSUPGLOBALINFOPAGE          pGip;
    548548#endif
    549549    /** Set if the session is using the GIP. */
     
    650650    uint64_t volatile       u64LastMonotime;
    651651    /** Set when GIP is suspended to prevent the timers from re-registering themselves). */
    652     uint8_t volatile        fGIPSuspended;           
     652    uint8_t volatile        fGIPSuspended;
    653653# ifdef CONFIG_SMP
    654654    /** Array of per CPU data for SUPGIPMODE_ASYNC_TSC. */
     
    686686void VBOXCALL   supdrvOSMemGetPages(PSUPDRVMEMREF pMem, PSUPPAGE paPages);
    687687void VBOXCALL   supdrvOSMemFreeOne(PSUPDRVMEMREF pMem);
    688 int  VBOXCALL   supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PCSUPGLOBALINFOPAGE *ppGip);
    689 int  VBOXCALL   supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PCSUPGLOBALINFOPAGE pGip);
     688int  VBOXCALL   supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip);
     689int  VBOXCALL   supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip);
    690690void  VBOXCALL  supdrvOSGipResume(PSUPDRVDEVEXT pDevExt);
    691691void  VBOXCALL  supdrvOSGipSuspend(PSUPDRVDEVEXT pDevExt);
  • trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h

    r2981 r3393  
    566566{
    567567    /** Pointer to the read-only usermode GIP mapping for this session. */
    568     R3PTRTYPE(PCSUPGLOBALINFOPAGE)  pGipR3;
     568    R3PTRTYPE(PSUPGLOBALINFOPAGE)   pGipR3;
    569569    /** Pointer to the supervisor mode GIP mapping. */
    570     R0PTRTYPE(PCSUPGLOBALINFOPAGE)  pGipR0;
     570    R0PTRTYPE(PSUPGLOBALINFOPAGE)   pGipR0;
    571571    /** The physical address of the GIP. */
    572572    RTHCPHYS                        HCPhysGip;
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r3177 r3393  
    9393 * @todo This will probably deserve it's own session or some other good solution...
    9494 */
    95 DECLEXPORT(PCSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage;
     95DECLEXPORT(PSUPGLOBALINFOPAGE) g_pSUPGlobalInfoPage;
    9696/** Address of the ring-0 mapping of the GIP. */
    97 static PCSUPGLOBALINFOPAGE      g_pSUPGlobalInfoPageR0;
     97static PSUPGLOBALINFOPAGE       g_pSUPGlobalInfoPageR0;
    9898/** The physical address of the GIP. */
    9999static RTHCPHYS                 g_HCPhysSUPGlobalInfoPage = NIL_RTHCPHYS;
     
    254254            else
    255255            {
    256                 LogRel(("Support driver version mismatch: SessionVersion=%#x DriverVersion=%#x ClientVersion=%#x\n", 
     256                LogRel(("Support driver version mismatch: SessionVersion=%#x DriverVersion=%#x ClientVersion=%#x\n",
    257257                        Out.u32SessionVersion, Out.u32DriverVersion, SUPDRVIOC_VERSION));
    258258                rc = VERR_VM_DRIVER_VERSION_MISMATCH;
     
    264264                 rc = VERR_VM_DRIVER_VERSION_MISMATCH;
    265265             if (rc == VERR_VM_DRIVER_VERSION_MISMATCH)
    266                  LogRel(("Support driver version mismatch: DriverVersion=%#x ClientVersion=%#x\n", 
     266                 LogRel(("Support driver version mismatch: DriverVersion=%#x ClientVersion=%#x\n",
    267267                         Out.u32DriverVersion, SUPDRVIOC_VERSION));
    268268             else
     
    343343
    344344        /* fake the GIP. */
    345         g_pSUPGlobalInfoPage = (PCSUPGLOBALINFOPAGE)RTMemPageAlloc(PAGE_SIZE);
     345        g_pSUPGlobalInfoPage = (PSUPGLOBALINFOPAGE)RTMemPageAlloc(PAGE_SIZE);
    346346        if (g_pSUPGlobalInfoPage)
    347347        {
     
    12571257                        pIn->eEPType                = pIn->EP_NOTHING;
    12581258                    pIn->offStrTab                  = offStrTab;
    1259                     pIn->cbStrTab                   = (uint32_t)CalcArgs.cbStrings; 
     1259                    pIn->cbStrTab                   = (uint32_t)CalcArgs.cbStrings;
    12601260                    AssertRelease(pIn->cbStrTab == CalcArgs.cbStrings);
    12611261                    pIn->offSymbols                 = offSymTab;
     
    12861286            }
    12871287        }
    1288         else if (VBOX_SUCCESS(rc) && fIsVMMR0) 
     1288        else if (VBOX_SUCCESS(rc) && fIsVMMR0)
    12891289            g_pvVMMR0 = OpenOut.pvImageBase;
    12901290    }
  • trunk/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c

    r3088 r3393  
    16711671 * @param   pDevExt     Instance data.
    16721672 */
    1673 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PCSUPGLOBALINFOPAGE *ppGip)
     1673int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip)
    16741674{
    16751675    int             rc = 0;
     
    17221722    if (!rc)
    17231723    {
    1724         *ppGip = (PCSUPGLOBALINFOPAGE)ulAddr;
     1724        *ppGip = (PSUPGLOBALINFOPAGE)ulAddr;
    17251725        dprintf2(("supdrvOSGipMap: ppGip=%p\n", *ppGip));
    17261726        return 0;
     
    17481748 * @param   pDevExt     Instance data.
    17491749 */
    1750 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PCSUPGLOBALINFOPAGE pGip)
     1750int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip)
    17511751{
    17521752    dprintf2(("supdrvOSGipUnmap: pGip=%p\n", pGip));
  • trunk/src/VBox/HostDrivers/Support/win32/SUPDrv-win32.cpp

    r2981 r3393  
    996996 * @param   pDevExt     Instance data.
    997997 */
    998 int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PCSUPGLOBALINFOPAGE *ppGip)
     998int VBOXCALL supdrvOSGipMap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE *ppGip)
    999999{
    10001000    dprintf2(("supdrvOSGipMap: ppGip=%p (pDevExt->pGipMdl=%p)\n", ppGip, pDevExt->pGipMdl));
     
    10071007    __try
    10081008    {
    1009         *ppGip = (PCSUPGLOBALINFOPAGE)MmMapLockedPagesSpecifyCache(pDevExt->pGipMdl, UserMode, MmCached, NULL, FALSE, NormalPagePriority);
     1009        *ppGip = (PSUPGLOBALINFOPAGE)MmMapLockedPagesSpecifyCache(pDevExt->pGipMdl, UserMode, MmCached, NULL, FALSE, NormalPagePriority);
    10101010    }
    10111011    __except(EXCEPTION_EXECUTE_HANDLER)
     
    10271027 * @param   pDevExt     Instance data.
    10281028 */
    1029 int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PCSUPGLOBALINFOPAGE pGip)
     1029int VBOXCALL supdrvOSGipUnmap(PSUPDRVDEVEXT pDevExt, PSUPGLOBALINFOPAGE pGip)
    10301030{
    10311031    dprintf2(("supdrvOSGipUnmap: pGip=%p (pGipMdl=%p)\n", pGip, pDevExt->pGipMdl));
  • trunk/src/VBox/Runtime/timesup.cpp

    r2981 r3393  
    7070    uint32_t    u32UpdateIntervalTSC;
    7171    uint32_t    u32TransactionId;
    72     PCSUPGLOBALINFOPAGE pGip;
     72    PSUPGLOBALINFOPAGE pGip;
    7373
    7474    /*
     
    101101        {
    102102            /* SUPGIPMODE_ASYNC_TSC */
    103             PCSUPGIPCPU pGipCpu;
     103            PSUPGIPCPU pGipCpu;
    104104
    105105            uint8_t u8ApicId = ASMGetApicId();
  • trunk/src/VBox/VMM/TM.cpp

    r3272 r3393  
    569569     */
    570570    uint64_t    u64Hz;
    571     PCSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
     571    PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
    572572    if (    pGip
    573573        &&  pGip->u32Magic == SUPGLOBALINFOPAGE_MAGIC)
  • trunk/src/VBox/VMM/VMMAll/TMAllVirtual.cpp

    r2981 r3393  
    6969    {
    7070        uint32_t u32TransactionId;
    71         PCSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
     71        PSUPGLOBALINFOPAGE pGip = g_pSUPGlobalInfoPage;
    7272#ifdef IN_RING3
    7373        if (RT_UNLIKELY(!pGip || pGip->u32Magic != SUPGLOBALINFOPAGE_MAGIC))
     
    9494        {
    9595            /* SUPGIPMODE_ASYNC_TSC */
    96             PCSUPGIPCPU pGipCpu;
     96            PSUPGIPCPU pGipCpu;
    9797
    9898            uint8_t u8ApicId = ASMGetApicId();
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