Contents

Flat Memory Model 58

Segmented Memory Model 59

Modes of Operation 59

3.3 Real Mode 60

Case Study: MS-DOS 62

Isn't This a Waste of Time? Wliy Study Real Mode? 64

The Real-Mode Execution Environment 65

Real-Mode Interrupts 67

Segmentation and Program Control 70

Case Study: Dumping the IVT 72

Case Study: Logging Keystrokes with a TSR 73

Case Study: Hiding the TSR 78

Case Study: Patching the TREE.COM Command 82

Synopsis 86

3.4 Protected Mode 87

The Protected-Mode Execution Environment 87

Pro tec led-Mode Segmentation 90

Protected-Mode Paging 94

Paging with Address Extension 96

A Closer Look at the Tables 98

A Closer Look at the Control Registers 100

3.5 Implementing Memory Protection 102

Protection Through Segmentation... .... . 102

Limit Checks 103

Type Checks 103

Privilege Checks 103

Restricted Instruction Checks 105

Gate Descriptors 106

The Protected-Mode Interrupt Table 109

Protection Through Paging 110

Summary 112

Chapter 4 System Briefing * * * 115

4.1 Physical Memory under Windows 116

Land of the Lost (Memory) 118

How Windows Uses Physical Address Extension 118

Pages, Page Frames, and Page Frame Numbers 120

4.2 Segmentation and Paging under Windows 120

vii