是“出局"吗?和“在"指令特权指令? [英] Are the "out" and "in" instructions privileged instructions?
问题描述
out
和 in
指令是特权指令吗?我假设它们是因为如果它们不是,那么在用户模式下运行的任何进程都可以访问端口映射的 I/O 硬件.但我在网上找不到任何可以证实这一点的内容.
Are the out
and in
instructions privileged instructions? I assume they are because if they were not, then any process running in user mode can access port mapped I/O hardware. But I can't find anything online that confirms that.
推荐答案
它们与 I/O 权限级别 (IOPL) 相关,如 OUT
和这里为 IN
.IOPL 是 (R|E)FLAGS
寄存器的第 12-13 位.如果当前权限级别大于(即小于权限)IOPL中的值,IN
和OUT
将不起作用.
They are tied to the I/O privilege level (IOPL), as documented here for OUT
and here for IN
. The IOPL is bits 12-13 of the (R|E)FLAGS
register. If the current privilege level is greater than (i.e. has less privilege than) the value in the IOPL, IN
and OUT
will not work.
这显然适用于实模式以外的操作模式,实模式没有任何权限级别的概念.
This obviously applies to operating modes other than real mode, which doesn't have any concept of privilege levels.
这篇关于是“出局"吗?和“在"指令特权指令?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!