关于CR0寄存器

    开始的时候,我认为CR0.WP如果被置位,那么内存的页面只读属性将会失效,导致可以被写入数据。

    这几天正好碰到一个问题,查看了资料才发现,之前的理解不完整。

    引用Intel手册中的一句话:

    CR0.WP allows pages to be protected from supervisor-mode writes. If CR0.WP = 0, supervisor-mode write accesses are allowed to linear addresses with read-only access rights; if CR0.WP = 1, they are not. (User-mode write accesses are never allowed to linear addresses with read-only access rights, regardless of the value of CR0.WP.) Section 4.6 explains how access rights are determined, including the definition of supervisor-mode and user-mode accesses.

    很显然,CR0.WP位只用于内核模式,在用户模式下不管CR0.WP是什么值,它对一个只读虚拟内存的写访问是不会成功的。

 

 

 

posted on 2014-02-26 09:13  emissary  阅读(1120)  评论(0编辑  收藏  举报

导航