2

I have been using Linux (Ubuntu). To communicate with IO devices, IO port addresses are used. For example, 0x378 is an address for a parallel port.

Is an IO port address an actual RAM address? If it's not, where does it reside?

3

Back to the root of the IBM PC which used 8088 microprocessor, separate address rooms were used for RAM and IO. The 8088 processor supported 20 bit addresses when accessing RAM, but used only 16 bit addresses for access IO. There was an extra pin on the processor to signalize whether RAM or IO is addressed.

This procedure is called port-mapped I/O and is still being used by actual X64-processors.

So the address 0x378 for parallel port does not present an address in RAM.

  • Means that address is built in processor ? processor already know that 0x378 is for parallel port and not for any other devices. – Usr1 Feb 20 '15 at 6:30
  • In the time before plug and play, I/O cards had either static address (like LPT:), or could be configured by jumpers or DIP-switches (to configure whether the card works as COM1: or COM2:). The processor didnot care about it, it was the BIOS who expected to find parallel port under 0x378. – user3767013 Feb 20 '15 at 7:56
1

Let's imagine that a CPU has only 4 pins (bits) to address devices. It means that it can select up to 16 devices, from 0000 to 1111.

Now think that RAM adressses are from 0000 to 0111 (8 addresses, very limited RAM), it leaves only other 8 (from 1000 to 1111) for other devices (Hard Disk, Serial Port, USB Port, Ethernet, Wifi,etc).

The same thing happens in a very big scale on actual CPUs, they have a space to address all the hardware limited by physical pins on the CPU. When the CPU starts, BIOS recognize the hardware installed and assign address space for each one of them.

In older systems, as DOS and Windows 3.1 it was usually established manually by configuration files as autoexec.bat and config.sys or by dip-switches and jumpers directly on the hardware. Modern systems do it dinamically via mechanisms as PCI and PCI Express.

  • Although modern PCI-related devices use memory-mapped I/O to access the hardware, legacy devices such as LPT: or COM: are still accessed with port-mapped I/O. – user3767013 Feb 19 '15 at 15:49
1

This isn't up to the OS, but the CPU. And the answer varies between CPU families.

On x86 (AMD/Intel), the answer is NO. The port example you give is typical for x86 PC's, and you can see from the length (16 bits) that it's not a 32 or 64 bits RAM address. The x86 has special instructions to communicate with IO ports, and these IO instructions know that IO addresses are 16 bits.

On ARM chips, which you might find in your phone, IO port addresses are in the same address range as RAM (but obviously at different addresses). An ARM chip uses the same type of instructions to read IO ports and memory, so in both cases you need a 32 bits address.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.