Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1236386
  • 博文数量: 389
  • 博客积分: 2874
  • 博客等级: 少校
  • 技术积分: 3577
  • 用 户 组: 普通用户
  • 注册时间: 2009-10-24 10:34
文章分类

全部博文(389)

文章存档

2020年(2)

2018年(39)

2017年(27)

2016年(3)

2015年(55)

2014年(92)

2013年(54)

2012年(53)

2011年(64)

分类: 虚拟化

2015-05-14 11:57:58

1) IO (ports) / MMIO. IO ports are in/out instructions, whereas MMIO has memory semantics.
   Everything starts with IO ports. Older devices (most ISA, many PCI) are entirely implemented with IO ports - including some notably important devices like the PS/2 controller or VGA device. But the key here is the PCI controller - it needs one specific IO port command (0xcf8 bit 31) to enable itself as MMIO and from there set up all other MMIO devices. So you need at least a few IO port accesses to bootstrap any MMIO access.
   It's certainly a legacy feature, much like real/protected mode. And it shows you how legacy cruft builds up: two decades ago, it was "better" to disable MMIO by default to avoid risk of breaking OSes that didn't know that PCI could overlay memory. PCIe finally switched to default-enabled, but only more recent OSes know how to use PCIe.

2) PIO (Programmed IO) / DMA. PIO is a mode of storage controllers which speak the ATA command set (basically, IDE controllers). PIO works by directly reading transferred bytes out of a register, whereas DMA works by setting up a command then waiting for an interrupt to be delivered.
    "Small" pieces of code tend to use PIO mode because it's much simpler to set up. Especially for firmware (BIOS/EFI) or bootloaders, which run with interrupts disabled and thus would get no advantage from the more complicated DMA mode. So: you need PIO for the first few seconds of the virtual machine's life, until it can bootstrap itself up to more advanced IO modes.

从一个国外网站摘的
阅读(1808) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~