当CS寄存器的CPL值等于0时,x86 CPU是否处于内核模式? [英] Is an x86 CPU in kernel mode when the CPL value of the CS register is equal to 0?

查看:312
本文介绍了当CS寄存器的CPL值等于0时,x86 CPU是否处于内核模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

CS寄存器的最后两位包含当前特权级别(CPL),该特权级别可以包含值0123.

The last two bits of the CS register contain the Current Privilege Level (CPL), which can contain either the value 0 or 1 or 2 or 3.

如果CPL的值为0,是否表示CPU处于内核模式(因此可以执行所有操作)?还是要使CPU进入内核模式还必须执行其他操作?

If the value of CPL is 0, does that mean the CPU is in kernel mode (and hence can do everything)? or are there other things that must apply in order for the CPU to be in kernel mode?

推荐答案

是的,CPL = 0表示内核/主管模式.但是,在实模式下,CPL也为0,但未反映在CS中.同样,在虚拟8086模式下,CPL为3,而不反映在CS中.

Yes, CPL=0 means kernel/supervisor mode. However, in real mode CPL is also 0 but not reflected in CS. Likewise, in virtual 8086 mode, CPL is 3 and not reflected in CS.

有些相关,您也可以通过使用SMSW指令检查CR0的位0(返回CR0的低16位)来检查保护模式.在虚拟8086模式下,该位将被设置为1,因为CPU只能通过保护模式到达该位置(您可以将前者视为后者的子模式).

Somewhat related, you may also check for protected mode by examining bit 0 of CR0 using the SMSW instruction (it returns 16 lower bits of CR0). The bit will be set to 1 in virtual 8086 mode because the CPU can get there only through protected mode (you may consider the former as a submode of the latter).

这篇关于当CS寄存器的CPL值等于0时,x86 CPU是否处于内核模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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