可在IN(以及INS,INSB等)x86汇编指令块? [英] Can the IN (as well as INS, INSB, etc.) instruction block in x86 assembly?

查看:289
本文介绍了可在IN(以及INS,INSB等)x86汇编指令块?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当试图从I / O端口在x86阅读(特别是奔腾),可在家庭中的指令阻塞在等待数据或将他们总是立即返回?

When trying to read from I/O ports on x86 (Pentium specifically), can the IN family of instructions block while waiting for data or will they always return immediately?

推荐答案

简短的回答:,从理论上讲,一个I / O设备的可能的导致CPU块上的I / O读取(指令)。

Short answer: Yes, in theory, an I/O device could cause the CPU to "block" on an I/O read (in instruction).

不过,我不知道有任何内存或实际停滞任何时间段显著I / O设备,造成CPU执行,以块。

However, I'm not aware of any memory or I/O devices that actually stalled for any significant period of time, causing CPU execution to "block".

龙答:

退出的指令执行I / O读/写,这几乎等同于一个典型存储器总线周期。唯一的区别是将不同的信号(多个)被断言,以指示I / O与存储器存取

The in and out instructions perform an I/O read/write, which is almost identical to a typical memory bus cycle. The only difference is that a different signal(s) is asserted to indicate I/O vs. memory access.

现在这得到pretty低层次,细节得到与后来的CPU更加复杂。我引用这个presentation 去到有关在x86总线周期信号电平的细节,从8086/8088。

Now this gets pretty low-level, and the details get more complex with later CPUs. I'm referencing this presentation goes into signal-level detail about the x86 bus cycles, starting with the 8086/8088.

8086/8088读周期1等待状态

http://www.ece.msstate.edu /~reese/EE3724/lectures/bustran/bustran.pdf

我们在这里看到,有一个就绪信号,这是由内存或I / O设备断言,以表明它已经presented其数据公交车,是的就绪的为CPU锁定它,这PDF州

We see here that there is a READY signal, which is asserted by the memory or I/O device, to indicate that it has presented its data to the bus, and is ready for the CPU to latch it in. That PDF states

86对控制总线

- 就绪输入选中T3在

– READY Input "Checked" During T3

- 如果READY无效(LOW),附加T3国加入

– If READY is Inactive (LOW), Additional T3 States are Added

- 这些附加的T3国被称为等待状态

– These Additional T3 States are Called "Wait States"

因此​​,它是可能的,至少这些旧的CPU,一个设备可以就绪,之前声称等待多个周期上的内存导致CPU为块或I / O指令。

So it is possible, with these older CPUs at least, that a device could wait many cycles before asserting READY, causing the CPU to "block" on the memory or I/O instruction.

我相信这仍然是有效的,至少要经过奔腾4 ,其中有一个 DRDY#(数据就绪)引脚,是通过在每个数据传输的数据驱动器断言,表明对数据的有效数据总线。在多共同的时钟的数据传送,DRDY#,可以解除断言插入空闲时钟

I believe this is still valid, at least through the Pentium 4, which has a DRDY# (Data Ready) pin that "is asserted by the data driver on each data transfer, indicating valid data on the data bus. In a multi-common clock data transfer, DRDY# may be de-asserted to insert idle clocks."

再回应:

使用早期的系统,相信很多的系统设备的直接连接到地址/数据/其他线路,并直接与CPU通信。因此,一些自定义或胭脂设备大概可以在一个总线周期摆摊。

With the early systems, I believe many of the system devices were connected directly to the address/data/other lines and communicated directly with the CPU. So some custom or rouge device could probably "stall" on a bus cycle.

现在天,该架构有很大不同。现代的x86处理器甚至没有地址和数据销本身,而是有一个像 DMI 和 QPI ,该传达给北桥/南桥(或的平台控制器中枢)设置。这些器件然后在内存/ IO请求适当的设备迈进。有了这个设置,我怀疑PCH将允许传出的I / O读来搪塞通过QPI链路的处理器的要求。

Now days, the architecture is much different. Modern x86 processors don't even have "address" and "data" pins per se, but instead have links like DMI and QPI, which communicate to a northbridge/southbridge (or Platform Controller Hub) setup. These devices then forward on the memory/IO requests to appropriate devices. With this setup, I doubt that the PCH would allow an outgoing I/O read to stall a processor request over the QPI link.

这篇关于可在IN(以及INS,INSB等)x86汇编指令块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆