osdevmemory-mapping

Where do memory mapped I/O addreses come from?


I am messing around with some hobbyist OS development, and I am a little confused on memory mapped I/O addresses. I understand the whole memory mapped I/O concept, but I am trying to figure out how developers get the addresses to manipulate hardware.

Are the addresses specified by the hardware vendors, or are they some sort of standard addresses for all computers? For example, VGA memory for text printing starts at address 0xB8000. Is that standard for every x86 machine? If so, who set that standard? And if I wanted to talk with an ethernet card, for example, how would I know the addresses or ports it uses for communication?

Thanks in advance.


Solution

  • I'm not 100% sure about who sets the addresses, but as far as I'm aware, hardware vendors can set their memory map however they want.

    For what it's worth, Linux lets you see how memory is currently mapped on your machine by doing cat /proc/iomem:

    00000000-0000ffff : reserved
    00010000-0009f3ff : System RAM
    0009f400-0009ffff : reserved
    000a0000-000bffff : PCI Bus 0000:00
      000a0000-000bffff : Video RAM area
    000c0000-000c7fff : Video ROM
    000ca000-000cbfff : reserved
      000ca000-000cafff : Adapter ROM
    000cc000-000cffff : PCI Bus 0000:00
    000d0000-000d3fff : PCI Bus 0000:00
    000d4000-000d7fff : PCI Bus 0000:00
    000d8000-000dbfff : PCI Bus 0000:00
    000dc000-000fffff : reserved
      000f0000-000fffff : System ROM
    00100000-3fedffff : System RAM
      01000000-01536143 : Kernel code
      01536144-017c007f : Kernel data
      01875000-0194bfff : Kernel bss
    3fee0000-3fefefff : ACPI Tables
    ....