I wonder if its possible to dynamically map/unmap device address range when Os is running to get access to physical memory?
You never access physical memory directly. You cannot. You always access the memory in the segment that is mapped to your own 2GB adress space, which is translated to lineair memory, which the OS maps to physical, virtual and device memory.
When your application starts, it is allocated it's own 2GB memory space. If you want to access something outside that, like a PCI device, you have to ask the OS (driver) to do it for you.
That 2GB of memory your application can use isn't allocated before you try to use it. It's only potential memory, so to say. As soon as you read or write it, the processor looks in it's page table to see if there is a page (originally 4kb, but 2MB pages are used as well, to keep the size of the page tables down) of memory allocated to that adress, and if it isn't, it asks the OS to do so.
And when the OS has allocated all the memory, it has to swap pages to disk when more is needed. And retrieve them when they are needed again.
So, the memory your application uses is distributed randomly across your physical memory and page file. There is no way for your application to find out where it is actually residing physically. And there is normally a much larger amount of adressable memory available to all the applications and devices together than can actually be mapped.