HiveBrain v1.2.0
Get Started
← Back to all entries
patternMinor

What is the avantage of having memory mapped I/O?

Submitted by: @import:stackexchange-cs··
0
Viewed 0 times
mappedthewhathavingavantagememory

Problem

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?

Solution

There are many advantages to memory mapped I/O

  • 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.



  • 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.



  • 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.

Context

StackExchange Computer Science Q#104739, answer score: 4

Revisions (0)

No revisions yet.