MMAP in pynq vta, pynq_driver.cc

I notice that, in ‘pynq_driver.cc’. There is a function called ‘VTAMapRegister’:

void *VTAMapRegister(uint32_t addr, size_t length) {
_ // Align the base address with the pages_
_ uint32_t virt_base = addr & ~(getpagesize() - 1);_
_ // Calculate base address offset w.r.t the base address_
_ uint32_t virt_offset = addr - virt_base;_
_ // Open file and mmap_
_ uint32_t mmap_file = open(VTA_PYNQ_DEV_MEM_PATH, O_RDWR|O_SYNC);_
_ return mmap(NULL,_
_ (length+virt_offset),_
_ PROT_READ|PROT_WRITE,_
_ MAP_SHARED,_
_ mmap_file,_
_ virt_base);_
}

In this function, in order to align with the pageSize, the ‘virt_offset’ is needed. However, in ‘VTAWriteMappedReg’ and ‘VTAReadMappedReg’,why not add the ‘virt_offset’?

void VTAWriteMappedReg(void* base_addr, uint32_t offset, uint32_t val) {
_ *((volatile uint32_t *) (reinterpret_cast<char *>(base_addr) + offset)) = val;_
}

uint32_t VTAReadMappedReg(void* base_addr, uint32_t offset) {
_ return *((volatile uint32_t *) (reinterpret_cast<char *>(base_addr) + offset));_
}

In your demo, this is OK, because the ‘virt_offset’ is Zero coincidently. My question is that, When transplanting this pynq_driver.h to other platform or modifying the base addr so that the ‘virt_offset’ is not zero, can it work correctly?