Important: The information in this document is obsolete and should not be used for new development.
Chapter 3 - Virtual Memory Manager
This chapter describes the Virtual Memory Manager, the part of the Operating System that allows memory to be extended beyond the limits of the physical address space provided by the available RAM. A user can select (in the Memory control panel) whether to enable this larger or "virtual" address space.Most applications are completely unaffected by the operation of the Virtual Memory Manager and have no need to know whether any virtual memory is available.
You might, however, need to intervene in the otherwise automatic workings of
the Virtual Memory Manager if your application has critical timing requirements, executes code at interrupt time, or performs debugging operations.The Virtual Memory Manager also offers services that might be of use to software components even if virtual memory is not enabled on a particular computer. On some Macintosh computers, the physical address space is discontiguous and is therefore not identical with the logical address space. In normal operations, the Operating System uses the MMU coprocessor to map logical addresses to their corresponding physical addresses. In some cases, however, you might need to perform this address mapping yourself. For example, if you are writing software that runs in the Macintosh Operating System but communicates addresses to NuBus(TM) expansion cards with bus master
or direct memory access (DMA) capabilities, you need to pass physical and not
logical addresses. You can use the Virtual Memory Manager to determine those
physical addresses.To use this chapter, you should be familiar with the normal operation of the Memory Manager, as described in the chapter "Introduction to Memory Management" in this book. If your application or other software executes code at interrupt time, you should also be familiar with the process of scheduling interrupt code, as described in the chapter "Introduction to Processes and Tasks" in Inside Macintosh: Processes.
This chapter begins with a description of how the Virtual Memory Manager provides virtual memory. It explains how the logical and physical address spaces are mapped to one another and when you might need to use the services provided by the Virtual Memory Manager. Then it explains how you can use the Virtual Memory Manager to
This chapter also provides information about a number of routines that are useful only for the implementation of debuggers that operate under virtual memory.
- make portions of the logical address space resident in physical RAM
- make portions of the logical address space immovable in physical RAM
- map logical to physical addresses
- defer execution of application-defined interrupt code until a safe time
Chapter Contents
- About the Virtual Memory Manager
- Virtual Memory
- The Logical Address Space
- 24-Bit Addressing
- 32-Bit Addressing
- The Physical Address Space
- Page Faults
- Using the Virtual Memory Manager
- Obtaining Information About Virtual Memory
- Holding and Releasing Memory
- Locking and Unlocking Memory
- Mapping Logical to Physical Addresses
- Deferring User Interrupt Handling
- Virtual Memory and Debuggers
- Bus-Error Vectors
- Special Nonmaskable Interrupt Needs
- Supervisor Mode
- The Debugging State
- Keyboard Input
- Page States
- Virtual Memory Manager Reference
- Data Structures
- Memory-Block Record
- Translation Table
- Routines
- Virtual Memory Management
- Virtual Memory Debugger Support Routines
- Summary of the Virtual Memory Manager
- Pascal Summary
- Constants
- Data Types
- Routines
- C Summary
- Constants
- Data Types
- Routines
- Assembly-Language Summary
- Data Types
- Trap Macros
- Result Codes