VirtualBox

Changeset 14645

Show
Ignore:
Timestamp:
11/26/08 15:09:41 (1 month ago)
Author:
vboxsync
Message:

SUP, VMM: Moved the max alloc/map page count to VBox/param.h

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/include/VBox/param.h

    r11177 r14645  
    3838 */ 
    3939 
     40/** The maximum number of pages that can be allocated and mapped 
     41 * by various MM, PGM and SUP APIs. */ 
     42#define VBOX_MAX_ALLOC_PAGE_COUNT   (128 * _1M / PAGE_SIZE) 
     43 
    4044 
    4145/** @defgroup   grp_vbox_param_mm  Memory Monitor Parameters 
     
    4650/** Initial address of Hypervisor Memory Area. 
    4751 * MUST BE PAGE TABLE ALIGNED! */ 
    48 #define MM_HYPER_AREA_ADDRESS   0xa0000000 
     52#define MM_HYPER_AREA_ADDRESS       UINT32_C(0xa0000000) 
    4953 
    5054/** The max size of the hypervisor memory area. */ 
    51 #define MM_HYPER_AREA_MAX_SIZE (20 * _1M) 
     55#define MM_HYPER_AREA_MAX_SIZE      (20 * _1M) 
    5256 
    5357/** Maximum number of bytes we can dynamically map into the hypervisor region. 
    5458 * This must be a power of 2 number of pages! 
    5559 */ 
    56 #define MM_HYPER_DYNAMIC_SIZE   (8 * PAGE_SIZE) 
     60#define MM_HYPER_DYNAMIC_SIZE       (8 * PAGE_SIZE) 
    5761 
    5862/** @} */ 
     
    6569 
    6670/** VMM stack size. */ 
    67 #define VMM_STACK_SIZE    8192 
     71#define VMM_STACK_SIZE              8192 
    6872 
    6973/** @} */ 
  • trunk/include/iprt/err.h

    r14494 r14645  
    493493/** End of string. */ 
    494494#define VINF_END_OF_STRING                  83 
     495/** A page count is ouf of range. */ 
     496#define VERR_PAGE_COUNT_OUT_OF_RANGE        (-84) 
    495497/** @} */ 
    496498 
  • trunk/src/VBox/HostDrivers/Support/SUPDrv.c

    r14575 r14645  
    4646#include <iprt/cpuset.h> 
    4747#include <iprt/uuid.h> 
     48#include <VBox/param.h> 
    4849#include <VBox/log.h> 
    4950#include <VBox/err.h> 
     
    20712072    if (cPages < 1 || cPages >= 256) 
    20722073    { 
    2073         Log(("Illegal request cPages=%d, must be greater than 0 and smaller than 256\n", cPages)); 
    2074         return VERR_INVALID_PARAMETER
     2074        Log(("Illegal request cPages=%d, must be greater than 0 and smaller than 256.\n", cPages)); 
     2075        return VERR_PAGE_COUNT_OUT_OF_RANGE
    20752076    } 
    20762077 
     
    21522153 
    21532154    } 
    2154     if (cPages < 1 || cPages > 256) 
     2155    if (cPages < 1 || cPages >= 256) 
    21552156    { 
    21562157        Log(("Illegal request cPages=%d, must be greater than 0 and smaller than 256.\n", cPages)); 
    2157         return VERR_INVALID_PARAMETER
     2158        return VERR_PAGE_COUNT_OUT_OF_RANGE
    21582159    } 
    21592160 
     
    23932394    AssertReturn(ppvR3 || ppvR0, VERR_INVALID_PARAMETER); 
    23942395    AssertReturn(!fFlags, VERR_INVALID_PARAMETER); 
    2395     if (cPages < 1 || cPages > (128 * _1M)/PAGE_SIZE
     2396    if (cPages < 1 || cPages > VBOX_MAX_ALLOC_PAGE_COUNT
    23962397    { 
    23972398        Log(("SUPR0PageAlloc: Illegal request cb=%u; must be greater than 0 and smaller than 128MB.\n", cPages)); 
    2398         return VERR_INVALID_PARAMETER
     2399        return VERR_PAGE_COUNT_OUT_OF_RANGE
    23992400    } 
    24002401 
  • trunk/src/VBox/HostDrivers/Support/SUPLib.cpp

    r14632 r14645  
    727727    AssertPtrReturn(ppvPages, VERR_INVALID_POINTER); 
    728728    *ppvPages = NULL; 
    729     AssertReturn(cPages > 0, VERR_INVALID_PARAMETER); 
     729    AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE); 
    730730 
    731731#ifdef RT_OS_WINDOWS 
     
    750750     */ 
    751751    AssertPtrReturn(pvPages, VERR_INVALID_POINTER); 
    752     AssertReturn(cPages > 0, VERR_INVALID_PARAMETER); 
     752    AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE); 
    753753 
    754754#ifdef RT_OS_WINDOWS 
     
    863863     */ 
    864864    AssertPtrReturn(pvPages, VERR_INVALID_POINTER); 
    865     AssertReturn(cPages > 0, VERR_INVALID_PARAMETER); 
     865    AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE); 
    866866 
    867867    /* 
     
    912912        *pR0Ptr = NIL_RTR0PTR; 
    913913    AssertPtrNullReturn(paPages, VERR_INVALID_POINTER); 
    914     AssertMsgReturn(cPages > 0 && cPages < 16384, ("cPages=%zu\n", cPages), VERR_INVALID_PARAMETER); 
     914    AssertMsgReturn(cPages > 0 && cPages <= VBOX_MAX_ALLOC_PAGE_COUNT, ("cPages=%zu\n", cPages), VERR_PAGE_COUNT_OUT_OF_RANGE); 
    915915 
    916916    /* fake */ 
     
    998998     */ 
    999999    AssertPtrReturn(pvPages, VERR_INVALID_POINTER); 
    1000     AssertReturn(cPages > 0, VERR_INVALID_PARAMETER); 
     1000    AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE); 
    10011001 
    10021002    /* fake */ 
     
    10991099        return VINF_SUCCESS; 
    11001100    AssertPtrReturn(pv, VERR_INVALID_POINTER); 
    1101     AssertReturn(cPages > 0, VERR_INVALID_PARAMETER); 
     1101    AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE); 
    11021102 
    11031103    /* fake */ 
     
    11341134    *ppvPages = NULL; 
    11351135    AssertPtrReturn(paPages, VERR_INVALID_POINTER); 
    1136     AssertMsgReturn(cPages > 0 && cPages < 256, ("cPages=%d must be > 0 and < 256\n", cPages), VERR_INVALID_PARAMETER); 
     1136    AssertMsgReturn(cPages > 0 && cPages < 256, ("cPages=%d must be > 0 and < 256\n", cPages), VERR_PAGE_COUNT_OUT_OF_RANGE); 
    11371137 
    11381138    /* fake */ 
     
    11991199        return VINF_SUCCESS; 
    12001200    AssertPtrReturn(pv, VERR_INVALID_POINTER); 
    1201     AssertReturn(cPages > 0, VERR_INVALID_PARAMETER); 
     1201    AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE); 
    12021202 
    12031203    /* fake */ 
  • trunk/src/VBox/HostDrivers/Support/linux/files_vboxdrv

    r14432 r14645  
    5959    ${PATH_ROOT}/include/VBox/err.h=>include/VBox/err.h \ 
    6060    ${PATH_ROOT}/include/VBox/log.h=>include/VBox/log.h \ 
     61    ${PATH_ROOT}/include/VBox/param.h=>include/VBox/param.h \ 
    6162    ${PATH_ROOT}/include/VBox/sup.h=>include/VBox/sup.h \ 
    6263    ${PATH_ROOT}/include/VBox/types.h=>include/VBox/types.h \ 
  • trunk/src/VBox/VMM/MMHyper.cpp

    r14637 r14645  
    537537    AssertPtrReturn(pvR3, VERR_INVALID_POINTER); 
    538538    AssertPtrReturn(paPages, VERR_INVALID_POINTER); 
    539     AssertReturn(cPages > 0, VERR_INVALID_PARAMETER); 
    540     AssertReturn(cPages < 128 * _1M / PAGE_SIZE, VERR_INVALID_PARAMETER); 
     539    AssertReturn(cPages > 0, VERR_PAGE_COUNT_OUT_OF_RANGE); 
     540    AssertReturn(cPages <= VBOX_MAX_ALLOC_PAGE_COUNT, VERR_PAGE_COUNT_OUT_OF_RANGE); 
    541541    AssertPtrReturn(pszDesc, VERR_INVALID_POINTER); 
    542542    AssertReturn(*pszDesc, VERR_INVALID_PARAMETER); 

© 2008 Sun Microsystems, Inc.
ContactPrivacy policy