【译】x86程序员手册17-第6章保护
Chapter 6 Protection 第六章 保护
6.1 Why Protection? 为什么要保护?
The purpose of the protection features of the 80386 is to help detect and identify bugs. The 80386 supports sophisticated applications that may consist of hundreds or thousands of program modules. In such applications, the question is how bugs can be found and eliminated as quickly as possible and how their damage can be tightly confined. To help debug applications faster and make them more robust in production, the 80386 contains mechanisms to verify memory accesses and instruction execution for conformance to protection criteria. These mechanisms may be used or ignored, according to system design objectives.
80386保护特性的目的是帮助侦测和识别错误。80386支持可能包含成百上千个模块组成的复杂的应用。在这样的应用中,如何找到并尽可能快速地消除错误和让损失最小成为重要问题。为了帮助快速调试应用,并让产品更健壮,80386包含了一种机制来验证内存访问和指令执行符合保护标准所要求的一致性。视系统设计者的目标而定,这些机制可以使用或被忽略。
6.2 Overview of 80386 Protection Mechanisms 80386保护机制的概览
Protection in the 80386 has five aspects:
80386的保护有以下5个方面:
- Type checking 类型检验
- Limit checking 限长检验
- Restriction of addressable domain 可寻址域的限定
- Restriction of procedure entry points 程序入口点的限定
- Restriction of instruction set 指令集的限定
The protection hardware of the 80386 is an integral part of the memory management hardware. Protection applies both to segment translation and to page translation.
80386的硬件保护是内存管理硬件的完整的部分。在段转换和页转换中都有保护。
Each reference to memory is checked by the hardware to verify that it satisfies the protection criteria. All these checks are made before the memory cycle is started; any violation prevents that cycle from starting and results in an exception. Since the checks are performed concurrently with address formation, there is no performance penalty.
每次引用内存硬件都会检验是否符合保护标准的需求。所有这些检验都在内存周期之前开始;任何违规都会阻止周期开始并引发异常。既然检验在地址构建同时开始,就不需要惩罚。
Invalid attempts to access memory result in an exception. Refer to Chapter 9 for an explanation of the exception mechanism . The present chapter defines the protection violations that lead to exceptions.
对内存的无效访问都会引发异常。参见第9章对异常机制的解释。当下章节定义引发异常的保护违例。
The concept of "privilege" is central to several aspects of protection (numbers 3, 4, and 5 in the preceeding list). Applied to procedures, privilege is the degree to which the procedure can be trusted not to make a mistake that might affect other procedures or data. Applied to data, privilege is the degree of protection that a data structure should have from less trusted procedures.
The concept of privilege applies both to segment protection and to page protection.