关于MMIO和PIO,我看到的解释最清楚的文章,原文在这里:Memory-mapped I/O vs port-mapped I/O - 2015

Microprocessors normally use two methods to connect external devices: memory mapped or port mapped I/O. However, as far as the peripheral is concerned, both methods are really identical.

Memory mapped I/O is mapped into the same address space as program memory and/or user memory, and is accessed in the same way.

Port mapped I/O uses a separate, dedicated address space and is accessed via a dedicated set of microprocessor instructions.

The difference between the two schemes occurs within the microprocessor. Intel has, for the most part, used the port mapped scheme for their microprocessors and Motorola has used the memory mapped scheme.

As 16-bit processors have become obsolete and replaced with 32-bit and 64-bit in general use, reserving ranges of memory address space for I/O is less of a problem, as the memory address space of the processor is usually much larger than the required space for all memory and I/O devices in a system.

Therefore, it has become more frequently practical to take advantage of the benefits of memory-mapped I/O. However, even with address space being no longer a major concern, neither I/O mapping method is universally superior to the other, and there will be cases where using port-mapped I/O is still preferable.

Memory-mapped IO (MMIO)

Picture source :IO Devices

I/O
devices are mapped into the system memory map along with RAM and ROM.
To access a hardware device, simply read or write to those 'special'
addresses using the normal memory access instructions.

The advantage to this method is that every instruction which can access memory can be used to manipulate an I/O device.

The
disadvantage to this method is that the entire address bus must be
fully decoded for every device. For example, a machine with a 32-bit
address bus would require logic gates to resolve the state of all 32
address lines to properly decode the specific address of any device.
This increases the cost of adding hardware to the machine.

Port-mapped IO (PMIO or Isolated IO)

Picture source : IO Devices

I/O
devices are mapped into a separate address space. This is usually
accomplished by having a different set of signal lines to indicate a
memory access versus a port access. The address lines are usually shared
between the two address spaces, but less of them are used for accessing
ports. An example of this is the standard PC which uses 16 bits of port
address space, but 32 bits of memory address space.

The
advantage to this system is that less logic is needed to decode a
discrete address and therefore less cost to add hardware devices to a
machine. On the older PC compatible machines, only 10 bits of address
space were decoded for I/O ports and so there were only 1024 unique port
locations; modern PC's decode all 16 address lines. To read or write
from a hardware device, special port I/O instructions are used.

From a software perspective, this is a slight disadvantage because more
instructions are required to accomplish the same task. For instance, if
we wanted to test one bit on a memory mapped port, there is a single
instruction to test a bit in memory, but for ports we must read the data
into a register, then test the bit.

Comparison - Memory-mapped vs port-mapped

Memory-mapped IO Port-mapped IO
Same address bus to address memory and I/O devices Different address spaces for memory and I/O devices
Access to the I/O devices using regular instructions Uses a special class of CPU instructions to access I/O devices
Most widely used I/O method x86 Intel microprocessors - IN and OUT instructions
Resource Monitor

We can check the reserved memory address space from the Resource Monitor via our desktop's Task Manager.

Memory-mapped I/O vs port-mapped I/O的更多相关文章

  1. System and method for parallel execution of memory transactions using multiple memory models, including SSO, TSO, PSO and RMO

    A data processor supports the use of multiple memory models by computer programs. At a device extern ...

  2. 【DM642学习笔记六】TI参考文档--DM642 Video Port Mini Driver

     这个文档介绍了在DM642EVM板上视频采集和显示微驱动的使用和设计.用EDMA进行存储器和视频端口的数据传输.为了增强代码的复用性和简化设计过程,驱动分为通用视频端口层和特定编解码芯片微驱动层两个 ...

  3. Anatomy of a Program in Memory

    Memory management is the heart of operating systems; it is crucial for both programming and system a ...

  4. [转]Anatomy of a Program in Memory

    Memory management is the heart of operating systems; it is crucial for both programming and system a ...

  5. Method and apparatus for providing total and partial store ordering for a memory in multi-processor system

    An improved memory model and implementation is disclosed. The memory model includes a Total Store Or ...

  6. Unity3D Optimizing Graphics Performance for iOS

    原地址:http://blog.sina.com.cn/s/blog_72b936d801013ptr.html icense Comparisons http://unity3d.com/unity ...

  7. linux 查看系统状态方法

    Linux下如何查看系统启动时间和运行时间 1.uptime命令输出:16:11:40 up 59 days, 4:21, 2 users, load average: 0.00, 0.01, 0.0 ...

  8. linux包之dmidecode

    http://www.dmtf.org/standards/smbios Dmidecode 这款软件允许你在 Linux 系统下获取有关硬件方面的信息.Dmidecode 遵循 SMBIOS/DMI ...

  9. System Address Map Initialization in x86/x64 Architecture Part 2: PCI Express-Based Systems

      原文  http://resources.infosecinstitute.com/system-address-map-initialization-x86x64-architecture-pa ...

  10. psutil官方文档

    psutil documentation¶ Quick links Home page Install Blog Forum Download Development guide What’s new ...

随机推荐

  1. kb-07专题线段树-04--离散化;

    /* poj2528 线段树 好题,用到了离散化,二分定位,特殊的区间查寻方式:在下面的代码注释中有详细的解释: */ #include<iostream> #include<cst ...

  2. 仔细瞄一下HashMap是怎么干活的

    以下分析基于jdk11.0.2 1. 创建HashMap时发生了什么? HashMap(),HashMap(int initialCapacity),HashMap(int initialCapaci ...

  3. Python [拷贝copy / 深度拷贝deepcopy] | 可视化理解

    Python 是一门面向对象的语言, 在Python一切皆对象. 每一个对象都有由以下三个属性组成: ------------------------------------------------- ...

  4. 【CF1029A】Many Equal Substrings(模拟)

    题意:给定一个长度为n的串s,要求构造一个长度最小的使s出现了k次的串,可以重叠 n<=50,k<=50 思路:计算一下前后缀相同长度 #include<cstdio> #in ...

  5. 【BZOJ4034】T2(树链剖分)

    题意: 有一棵点数为 N 的树,以点 1 为根,且树点有边权.然后有 M 个 操作,分为三种: 操作 1 :把某个节点 x 的点权增加 a . 操作 2 :把某个节点 x 为根的子树中所有点的点权都增 ...

  6. 【MFC】error RC2108: expected numerical dialog constant(转)

    原文转自 http://blog.csdn.net/renyhui/article/details/23120469 [解决方案]在控件ID后面添加 "Static", SS_BI ...

  7. PHP读取APK的包信息,包括包名,应用名,权限,LOGO等

    [转]PHP读取APK的包信息,包括包名,应用名,权限,LOGO等 声明本文转自: 原文链接:https://www.jb51.net/article/53780.htm: 感谢分享! <?ph ...

  8. Java 界面编程【03】事件监听

    当你把界面都设计好了,总需要添加相应的执行动作给组件,在JAVA中有相应的时间处理机制,叫做“监听器”,给组件添加相应执行动作的过程叫做“注册”,其中的“监听器”是一个接口,里面包含了相应的执行函数, ...

  9. 【APIO2016】Gap

    题目描述 有 $N$ 个严格递增的非负整数 $a_1, a_2, \dots, a_N$($0 \leq a_1 < a_2 < \cdots < a_N \leq 10^{18}$ ...

  10. BZOJ1003物流運輸 DP + SPFA

    @[DP, SPFA] Description 物流公司要把一批货物从码头A运到码头B.由于货物量比较大,需要\(n\)天才能运完.货物运输过程中一般要转 停好几个码头.物流公司通常会设计一条固定的运 ...