C++ Memory Management
Total Page:16
File Type:pdf, Size:1020Kb
C++ Memory Management Len Dorfman Marc J. Neuberger Winderest /McGraw-Hill New York San Francisco Washington, D.C. Auckland Bogota Caracas Lisbon London Madrid Mexico City Milan Montreal New Delhi San Juan Singapore Sydney Tokyo Toronto Contents What you need to use this book Introduction 1 Memory management overview Using expanded memory for dynamic memory allocation Using extended memory for dynamic memory allocation Using the hard disk for dynamic memory allocation 7 Summary 7 2 Understanding memory control blocks Preparatory memory management routines 11 Writing a memory chain display utility program 12 Summary 23 3 EMS 3.0 and 3.2 About the EMS programmer's interface 25 EMS 3.0 demonstration programs 26 The EMS 3.0 and 3.2 interface 46 C++ interface functions 64 Initialize EMS 64 Get the EMM status 64 Get the page frame address 66 Get the number of free EMS pages 67 Allocate EMS handle and pages 68 Map an expanded memory page 70 Free a handle and the associated EMS pages 71 Get the EMS version number 72 Save the contents of page map registers 74 Restore the contents of page map registers 75 Get the number of active EMM handles 76 Get number of pages for handle 77 Get number of pages for all handles 79 EMS 3.2 functions 81 Save page map to a buffer 81 Restore page map from a buffer 82 Swap page maps 83 Get the size of a map register save area 85 Summary 87 4 EMS 4.0 EMS 4.0 enhancements 89 EMS 4.0 demonstration programs 90 C++interface functions 115 Save a partial page map 115 Restore a partial page map 117 Get the size of partial page map information 1 Map multiple pages by number 119 Map multiple pages by address 121 Reallocate pages for handle 123 Get handle attribute 124 Set handle attribute 125 Get attribute capabilities 126 Get handle name 128 Set handle name 130 Get all handle names 131 Search for handle name 132 Get total number of handles 134 Map pages by number and jump 135 Map pages by segment and jump 137 Map pages by number and call 138 Map pages by segment and call 140 Get stack space for map and call 141 Move a memory region 143 Swap memory regions 144 Get addresses of mappable pages 146 Get number of mappable pages 148 Get hardware configuration 149 Get number of raw pages 150 Allocate handle and standard pages 152 Allocate handle and raw pages 153 Prepare EMM for warm boot 154 EMS 4.0 operating-system-only functions 156 Summary 156 5 Extended Memory Specification (XMS) 2.0 157 An overview of the XMS interface 158 XMS 2.0 demonstration programs 159 The XMS interface classes 184 The XMS assembly language definition file 193 Initialize the XMS interface 195 Get the XMS version number 197 Allocate the HMA (High Memory Area) 198 Release the HMA (High Memory Area) 200 Enable the global A20 line 201 Disable the global A20 line 202 Get the current A20 line state 203 Get amount of free extended memory 204 Allocating an extended memory block 206 Free an extended memory block 207 Copy an extended memory block 208 Lock an extended memory block 210 Unlock an extended memory block 211 Get extended memory block information 212 Resize an extended memory block 214 Allocate an Upper Memory Block (UMB) 215 Release an Upper Memory Block (UMB) 217 Move raw XMS memory 218 XMS function error reporting 220 Summary 220 6 The Virtual Memory Manager 221 An overview of the Virtual Memory Manager 221 Overview of the VMM's architecture 222 Initialize the VMM 224 Shut down the VMM 224 Allocate a VMM block 224 Free a previously allocated VMM block 225 Wire a VMM area for reading and writing 225 Unwire a VMM page 225 VMM demonstration programs 226 The complete VMM source code listings 232 Summary 288 Epilogue 289 Index 291 .