3
$\begingroup$

I can't make out what is the avantage of it comparing with the port designed I/O

Is it faster? Is it more reliable? Is it cheaper?

$\endgroup$
1
  • $\begingroup$ This is asked in Quora. $\endgroup$
    – xskxzr
    Commented Feb 23, 2019 at 9:39

2 Answers 2

4
$\begingroup$

There are many advantages to memory mapped I/O

  1. Access: Memory mapped devices use the same instructions/addressing modes as regular memory. These map well into high level languages allowing device drivers to manipulate devices without the need to drop down into assembly language to use special I/O instructions.
  2. Security: As memory addressed devices, memory management hardware can be used to control access to those devices. Generally, I/O instructions are "wide open" in privileged modes allowing a driver to access any I/O mapped device, even those that it should not.
  3. Flexibility: Almost without exception, the processor instructions available for memory are more varied and versatile than those for I/O mapped. With memory, load/store instructions are supplemented with various monodic (inc/dec/etc) and dyadic (add/sub/etc) operators. Special I/O mode instructions are generally limited to load/store. This typically gives the compiler a better shot at creating better code (ignoring the whole RISC/CISC debate for now).

Support for special I/O mapping is generally a legacy issue. The x86 for example is (on some level) compatible all the way back to the 8008.

Very old processors often included I/O mapped device support because the memory address space was so small (often 65,536 bytes or less) that I/O addressing provided a way to preserve memory address space for actual memory.

Modern processors have larger (4G or larger) address spaces so that this is no longer an issue.

$\endgroup$
0
$\begingroup$

If you rely on port io you drive up the pin count. Memory mapping provides a more flexible method in the design. They're really two very different things with different intentions. Ports are generally speaking extensions of the processor that map to specific functions. A memory map is a extension that allows access. It's more abstract. At least until you put something into the map. :)

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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