VirtualBox

Changeset 2014 in vbox for trunk/src


Ignore:
Timestamp:
Apr 10, 2007 3:56:23 PM (18 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
20302
Message:

r=bird: some cleanup of the cPages change.

Location:
trunk/src/VBox/HostDrivers/Support
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/HostDrivers/Support/SUPDRVIOC.h

    r1891 r2014  
    174174 * The upper 16-bit is the major version, the the lower the minor version.
    175175 * When incompatible changes are made, the upper major number has to be changed. */
    176 #define SUPDRVIOC_VERSION           0x00050004
     176#define SUPDRVIOC_VERSION           0x00050000
    177177
    178178/** SUP_IOCTL_COOKIE Input. */
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r1893 r2014  
    197197        strcpy(In.szMagic, SUPCOOKIE_MAGIC);
    198198        In.u32ReqVersion = SUPDRVIOC_VERSION;
    199         if (SUPDRVIOC_VERSION < 0x00050000)
    200             In.u32MinVersion = 0x00040004;
    201         else
    202             In.u32MinVersion = SUPDRVIOC_VERSION & 0xffff0000;
     199        In.u32MinVersion = SUPDRVIOC_VERSION & 0xffff0000;
    203200        rc = suplibOsIOCtl(SUP_IOCTL_COOKIE, &In, sizeof(In), &Out, sizeof(Out));
    204201        if (VBOX_SUCCESS(rc))
    205202        {
    206             if (    (Out.u32SessionVersion & 0xffff0000) == (SUPDRVIOC_VERSION & 0xffff0000)
    207                 &&  Out.u32SessionVersion >= 0x00040004)
     203            if ((Out.u32SessionVersion & 0xffff0000) == (SUPDRVIOC_VERSION & 0xffff0000))
    208204            {
    209205                /*
  • trunk/src/VBox/HostDrivers/Support/linux/SUPLib-linux.cpp

    r1890 r2014  
    5151#define DEVICE_NAME     "/dev/vboxdrv"
    5252
     53/* define MADV_DONTFORK if it's missing from the system headers. */
    5354#ifndef MADV_DONTFORK
    54 #define MADV_DONTFORK      10
     55# define MADV_DONTFORK  10
    5556#endif
    5657
     
    6364/** Flags whether or not we've loaded the kernel module. */
    6465static bool     g_fLoadedModule = false;
    65 /** Checks */
     66/** Indicates whether madvise(,,MADV_DONTFORK) works. */
    6667static bool     g_fSysMadviseWorks = false;
    6768
     
    127128
    128129    /*
    129      * Check driver version.
    130      */
    131     /** @todo implement driver version checking. */
    132 
    133     /*
    134130     * Check if madvise works.
    135131     */
     
    266262#else
    267263    size_t cbMmap = (g_fSysMadviseWorks ? cPages : cPages + 2) << PAGE_SHIFT;
    268     char *pvPages = (char*)mmap(NULL, cbMmap, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
     264    char *pvPages = (char *)mmap(NULL, cbMmap, PROT_READ | PROT_WRITE, MAP_PRIVATE | MAP_ANONYMOUS, -1, 0);
    269265    if (pvPages)
    270266    {
  • trunk/src/VBox/HostDrivers/Support/testcase/tstContiguous.cpp

    r1890 r2014  
    7575    }
    7676
    77     /* useless since SUPContAlloc/SUPContFree use cPages now */
    78 #if 0
    79     /*
    80      * 2nd part
    81      */
    82     if (!rcRet)
    83     {
    84         rc = SUPInit();
    85         RTPrintf("tstContiguous: SUPInit -> rc=%Vrc\n", rc);
    86         rcRet += rc != 0;
    87         if (!rc)
    88         {
    89             for (int i = 0; i < 256; i++)
    90             {
    91                 RTHCPHYS HCPhys = 0;
    92                 void *pv = SUPContAlloc(PAGE_SIZE + 512 + i, &HCPhys);
    93                 rcRet += pv == NULL || HCPhys == 0;
    94                 if (pv && HCPhys)
    95                 {
    96                     memset(pv, 0x7f, PAGE_SIZE + 512 + i);
    97                     rc = SUPContFree(pv);
    98                     rcRet += rc != 0;
    99                     if (rc)
    100                         RTPrintf("tstContiguous: %d: SUPContFree failed! rc=%Vrc\n", i, rc);
    101                 }
    102                 else
    103                     RTPrintf("tstContiguous: %d: SUPContAlloc failed!\n", i);
    104             }
    105 
    106             rc = SUPTerm();
    107             RTPrintf("tstContiguous: SUPTerm -> rc=%Vrc\n", rc);
    108             rcRet += rc != 0;
    109         }
    110     }
    111 #endif
    112 
    11377    return rcRet;
    11478}
  • trunk/src/VBox/HostDrivers/Support/testcase/tstPin.cpp

    r1890 r2014  
    5454        for (unsigned i = 0; i < sizeof(aPinnings) / sizeof(aPinnings[0]); i++)
    5555        {
    56 #ifdef __OS2__
    5756            aPinnings[i].pv = NULL;
    5857            SUPPageAlloc(0x10000 >> PAGE_SHIFT, &aPinnings[i].pv);
    59 #else
    60             aPinnings[i].pv = malloc(0x10000);
    61 #endif
    6258            aPinnings[i].pvAligned = ALIGNP(aPinnings[i].pv, PAGE_SIZE);
    6359            rc = SUPPageLock(aPinnings[i].pvAligned, 0xf000 >> PAGE_SHIFT, &aPinnings[i].aPages[0]);
     
    7975                RTPrintf("SUPPageLock -> rc=%d\n", rc);
    8076                rcRet++;
    81 #ifdef __OS2__
    8277                SUPPageFree(aPinnings[i].pv, 0x10000 >> PAGE_SHIFT);
    83 #else
    84                 free(aPinnings[i].pv);
    85 #endif
    8678                aPinnings[i].pv = aPinnings[i].pvAligned = NULL;
    8779                break;
     
    108100            {
    109101                memset(aPinnings[i].pv, 0xcc, 0x10000);
    110 #ifdef __OS2__
    111102                SUPPageFree(aPinnings[i].pv, 0x10000 >> PAGE_SHIFT);
    112 #else
    113                 free(aPinnings[i].pv);
    114 #endif
    115103                aPinnings[i].pv = NULL;
    116104            }
     
    152140        #define BIG_SIZE    72*1024*1024
    153141        #define BIG_SIZEPP  (BIG_SIZE + PAGE_SIZE)
    154 #ifdef __OS2__
    155142        pv = NULL;
    156143        SUPPageAlloc(BIG_SIZEPP >> PAGE_SHIFT, &pv);
    157 #else
    158         pv = malloc(BIG_SIZEPP);
    159 #endif
    160144        if (pv)
    161145        {
     
    187171                rcRet++;
    188172            }
    189 #ifdef __OS2__
    190173            SUPPageFree(pv, BIG_SIZEPP >> PAGE_SHIFT);
    191 #else
    192             free(pv);
    193 #endif
    194174        }
    195175
Note: See TracChangeset for help on using the changeset viewer.

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