Re: Virtual to physical address mapping

From: Richard B. Johnson (
Date: Wed Sep 18 2002 - 07:06:39 EST

On 18 Sep 2002, Ole [ISO-8859-1] André Vadla [ISO-8859-1] Ravnås wrote:

> Thanks, but the address specified there is certainly not the same as the
> base address ifconfig reports. I made a simple program to verify this:


`ifconfig` reports the base address of a port (I don't know why).
There are other addresses in use.

eth0 Link encap:Ethernet HWaddr 00:50:DA:19:7A:7D
          inet addr: Bcast: Mask:
          RX packets:2630005 errors:0 dropped:0 overruns:0 frame:0
          TX packets:307396 errors:0 dropped:0 overruns:0 carrier:0
          collisions:2430 txqueuelen:100
          Interrupt:10 Base address:0xb800


A private version of `lspci` that actually reads the PCI ports

Device Vendor Type
   0 Intel Corporation 440BX/ZX - 82443BX/ZX Host bridge
  11 3Com Corporation 3c905B 100BaseTX [Cyclone]
       IRQ 10 Pin A
       I/O ports : 0xb800->0xb87e
       I/O memory : 0xdf800000->0xdf80007f

Notice that it has memory-mapped I/O.
That said, neither of these addresses are the virtual addresses.
On an ix86, these are physical addresses which are the same as
the bus addresses. Other machines may not have the same physical
and bus address. The virtual address is whatever mmap() returns
in user-space, and whatever ioremap() returns in kernel space.
Note that in kernel space, the returned value should not be used
as a pointer. There are macros defined to access the I/O addressed
elements. See .../linux/Documentation/IO-mapping.txt.

Dick Johnson
Penguin : Linux version 2.4.18 on an i686 machine (797.90 BogoMips).
The US military has given us many words, FUBAR, SNAFU, now ENRON.
Yes, top management were graduates of West Point and Annapolis.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

This archive was generated by hypermail 2b29 : Mon Sep 23 2002 - 22:00:22 EST