Am Tue, Apr 20, 2021 at 09:23:08AM +0200 schrieb Alessandro Pistocchi:
> Thanks very much :-)
> 
> I did not know about the eprom -p and it's actually very nice to have it.
> 
> The info you gave me are mostly about the address of those peripherals in
> physical memory.
> 
> What I was after was the virtual address at which peripherals get mapped
> inside the kernel.
> This is specific to OpenBSD.
> 
> In my understanding, which could be wrong by the way, the arm 64 kernel is
> not allowed
> to access memory below 0xFFFF000000000000, which is at the end of the 64
> bit space,
> so in order to drive the hardware it must map the physical addresses (
> which live either in
> a 32 or 35 bit address space ) to a much higher memory location.
> 
> Best,
> Alessandro

Does it matter?  Why?

An MMU sits between the CPU and RAM.  Each memory access is translated
from a virtual address to a physical address (from the CPU/MMU point of
view).  There is one kernel pagetable, which uses virtual addresses
starting with all those Fs, and then there are a number of user page-
tables which are activated on demand, depending on which process is
currently running.

Access to the device registers is being created through bus_space_map(),
which allocates a virtual address range and then maps the VA to the PA.
Now the virtual addresses provided by the allocator can be random.

I think the confusion you have is that you expect that the whole range
of physical registers is mapped to some virtual address of the same size
and that by knowing the 'base address' you could access all of them.
But that's not the case.

Each driver only maps register space *as needed* to some random virtual
address.  You can *not* take the virtual address of one device, add some
offset and reach the other one.  It's not a 'direct map'.

Patrick

Reply via email to