/* Work around for GDB crash... */ static int dontStepInThis() { int ps; ps = vmPageSizeGet(); return ps; }
/*************gpioInit()***************************/ void gpioInit(void){ int pageSize; pageSize = vmPageSizeGet(); if(vmMap(NULL, GPIO_BASE_VIRT_ADDR, GPIO_BASE_PHYS_ADDR, pageSize) == ERROR){ //remap physcial address to virtual address printf("Error mapping memory errno\n"); } GPIO_GPDR |= GPIO3_MASK; //switch gpio3 to output mode }
// neither getpagesize() or sysconf(_SC_PAGESIZE) are available int getpagesize() { #if defined(_WRS_KERNEL) return vmPageSizeGet(); #else return sysconf(_SC_PAGESIZE); #endif }
// neither getpagesize() or sysconf(_SC_PAGESIZE) are available int getpagesize() { return vmPageSizeGet(); }
STATUS vmContextShow ( VM_CONTEXT_ID context /* context - NULL == currentContext */ ) { UINT thisVirtPage; UINT thisPhysPage; UINT blockBegin; UINT physPageAddr; UINT thisState; UINT blockPhysAddr; UINT blockState; int vmPageSize; int physPageInc; int numPages; int pageCounter; BOOL blockEnd; BOOL printIt; BOOL previousPageWasInvalid; vmPageSize = vmPageSizeGet (); if (vmPageSize == 0) return (ERROR); /* vmLib is not installed! */ numPages = (unsigned) 0x80000000 / vmPageSize * 2; pageCounter = 0; blockEnd = FALSE; blockPhysAddr = NULL; printIt = TRUE; previousPageWasInvalid = TRUE; if (context == NULL) context = vmCurrentGet (); if (OBJ_VERIFY (context, vmContextClassId) != OK) return (ERROR); if (mmuPhysAddrShift) { printf ("VIRTUAL ADDR BLOCK LENGTH PHYSICAL PAGE STATE\n"); physPageInc = 1; } else { printf ("VIRTUAL ADDR BLOCK LENGTH PHYSICAL ADDR STATE\n"); physPageInc = vmPageSize; } semTake (&context->sem, WAIT_FOREVER); thisVirtPage = thisPhysPage = 0; vmStateGet (context, (void *) 0, &blockState); for (blockBegin = 0; pageCounter < numPages; pageCounter++, thisVirtPage += vmPageSize, thisPhysPage += physPageInc) { if (vmTranslate (context, (void *) thisVirtPage, (void **) &physPageAddr) == ERROR) { blockEnd = TRUE; if (previousPageWasInvalid) printIt = FALSE; previousPageWasInvalid = TRUE; thisPhysPage = 0xffffffff; } else { if (!previousPageWasInvalid && (physPageAddr != thisPhysPage)) blockEnd = TRUE; if (vmStateGet (context, (void *) thisVirtPage, &thisState)== ERROR) { printf ("vmContextShow: error getting state for addr %x\n", thisVirtPage); return (ERROR); } if (!previousPageWasInvalid && (thisState != blockState)) blockEnd = TRUE; if (previousPageWasInvalid) { blockBegin = thisVirtPage; blockPhysAddr = thisPhysPage = physPageAddr; blockState = thisState; } previousPageWasInvalid = FALSE; } if (blockEnd) { if (printIt) vmContextShowNewBlock (blockBegin, thisVirtPage, blockPhysAddr, blockState); blockBegin = thisVirtPage; blockState = thisState; blockPhysAddr = thisPhysPage = physPageAddr; blockEnd = FALSE; printIt = TRUE; } } /* see if there was a block that went up to the last virtual page */ if (!previousPageWasInvalid) vmContextShowNewBlock (blockBegin, thisVirtPage, blockPhysAddr, blockState); semGive (&context->sem); return (OK); }
/** * Gets the page size (in bytes) of the system. * * @return the page size (in bytes) of the system */ int sysGetPageSize() { return vmPageSizeGet(); /* 0x1000 */ }