80386 programmer's reference manual Chapter 6 Protection notes

1. Why protection?

Identify and detect bugs.

2. Overview: 5 aspects

Type checking
Limit checking
Restriction of addressable domain
Restriction of procedure entry points
Restriction of instruction set

Protection is a hardware mechanism, applies both to segment translation and to page translation.

3. Segment level protection.

Here we mainly talking about Privilege levels.

Segment descriptor contains a filed called DPL(descriptor privilege level)

Selectors contains RPL(requestor's privilege level)

An internal register contains CPL(current privilege level), usually CPL = DPL, it changes when controls transferred to different segments.

The processor automatically evaluates the right of a procedure to access
another segment by comparing the CPL to one or more other privilege levels.
The evaluation is performed at the time the selector of a descriptor is
loaded into a segment register. The criteria used for evaluating access to
data differs from that for evaluating transfers of control to executable
segments; therefore, the two types of access are considered separately in
the following sections.
DPL >= max(CPL, RPL);

The instructions that affect system data structures can only be executed
when CPL is zero. If the CPU encounters one of these instructions when CPL
is greater than zero, it signals a general protection exception. These
instructions include:
CLTS
HLT
LGDT
LIDT
LLDT
LMSW
LTR
MOV to/from CRn
MOV to /from DRn
MOV to/from TRn


發佈了44 篇原創文章 · 獲贊 44 · 訪問量 10萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章