什么是&放大器;在86 OUT指令用的? [英] What are IN & OUT instructions in x86 used for?

查看:220
本文介绍了什么是&放大器;在86 OUT指令用的?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我encoutered这些以指令和放大器; OUT在阅读理解Linux内核一书。我抬头一看参考手册。


  

5.1.9 I / O指令


  
  

这些指令之间移动数据
  处理器的I / O端口和一个
  注册或内存中。

 读入从端口
OUT写入到一个端口
从端口的端口/输入字节的字符串INS / INSB输入字符串
从端口的端口/输入字串INS / INSW输入字符串
从端口/输入INS / INSD输入字符串从口双字字符串
OUTS / OUTSB输出字符串到端口/输出字节串到端口
OUTS / OUTSW输出字符串到端口/输出字串端口
OUTS / OUTSD输出字符串到端口/输出双串口


我没有得到几件事情:


  1. 处理器的I / O端口。他们是什么?我们为什么要读&安培;写串到&安培;这些端口?

  2. 我从来没有encoutered一之情况,我需要使用这些指令。当我被这些需要?

  3. 提供一些实际的例子。


解决方案

您知道如何内存寻址的作品?该CPU使总线上存储器的一个字节的地址,然后提出了一个读信号,有的RAM芯片有望在该地址返回内存中的内容。

RAM和IO设备被连接到相同的地址,数据和控制线。每个IO设备被配置为向地址线的某种组合(这是IO地址)作出响应。有一个名为M /#IO信号线。当您使用IN或OUT指令,M /#IO不被肯定,所以内存和IO设备知道CPU会谈IO设备。对于其他指示,M /#IO被断言所以CPU会谈到RAM和IO设备不与通信干扰

在特定条件下的IO设备可以驱动数据线和RAM可以在同一时间读取它们。反之亦然。这就是所谓的DMA。

传统地,串行和打印机端口,以及键盘,鼠标,温度传感器等分别的I / O设备。磁盘是那种介于两者之间;数据传输将由I / O命令来启动,但在系统内存中的磁盘控制器通常会直接存入其数据。

I've encoutered these to instructions IN & OUT while reading "Understanding Linux Kernel" book. I've looked up reference manual.

5.1.9 I/O Instructions

These instructions move data between the processor’s I/O ports and a register or memory.

IN    Read from a port
OUT   Write to a port
INS/INSB  Input string from port/Input byte string from port 
INS/INSW  Input string from port/Input word string from port 
INS/INSD  Input string from port/Input doubleword string from port
OUTS/OUTSB    Output string to port/Output byte string to port 
OUTS/OUTSW    Output string to port/Output word string to port 
OUTS/OUTSD    Output string to port/Output doubleword string to port

I didn't get few things:

  1. "processor’s I/O ports". What are they? Why would we want to read & write "strings" to & from these ports?
  2. I never encoutered a scenerio where I need to use these instructions. When would I be needing these?
  3. Give some practical examples.

解决方案

You know how memory addressing works? The CPU puts the address of a byte of memory on the bus, then raises the READ signal, and some RAM chip hopefully returns the contents of memory at that address.

Both RAM and IO devices are connected to the same address, data and control lines. Every IO device is configured to respond to a certain combination of address lines (that's the IO address). There's a signal line called M/#IO. When you use the IN or OUT instructions, the M/#IO is not asserted, so both memory and IO devices know that the CPU talks to IO devices. For the rest of instructions, M/#IO is asserted so CPU talks to the RAM and IO devices do not interfere with the communication.

Under certain conditions the IO devices can drive the data lines and the RAM can read them at the same time. And vice versa. It's called DMA.

Traditionally, serial and printer ports, as well as keyboard, mouse, temperature sensors and so forth were I/O devices. Disks were sort of in between; data transfers would be initiated by I/O commands but the disk controller would usually direct-deposit its data in system memory.

这篇关于什么是&放大器;在86 OUT指令用的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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