Memory

In the x86 architecture, memory is categorized into different regions based on their address range. Understanding these categories is crucial for system programming and operating system development. Two primary regions are Low Memory (Conventional Memory) and Extended Memory.

1️⃣ Low Memory (Conventional Memory)

  • Definition: Low Memory, also known as Conventional Memory, refers to the first 1 MB of the physical address space in an x86 system.
  • Address Range: 0x00000 to 0xFFFFF (0 to 1 MB).
  • Historical Context: This memory region was originally designed for use by the operating system, BIOS, and DOS applications. It follows the memory model of the original IBM PC.
  • Usage:
    • BIOS: Basic Input/Output System (BIOS) uses the upper portion of this memory for its data and interrupt vectors.
    • Operating System: Early operating systems and bootloaders reside in this region.
    • DOS Applications: DOS and early PC applications run within this 1 MB space.
    • Video Memory: A portion of this memory (typically starting at 0xA0000) is reserved for video memory in text and graphics modes.

2️⃣ Extended Memory

  • Definition: Extended Memory refers to all physical memory addresses above 1 MB.
  • Address Range: 0x100000 and above (1 MB and higher).
  • Historical Context: As PCs evolved and required more memory than what was available in Conventional Memory, the concept of Extended Memory was introduced.
  • Usage:
    • Operating Systems: Modern operating systems, such as Windows and Linux, utilize Extended Memory to provide a larger memory space for applications and system processes.
    • Protected Mode: To access Extended Memory, systems switch from Real Mode to Protected Mode or Long Mode, allowing for the use of 32-bit or 64-bit address spaces.
    • High-Performance Applications: Applications that require large amounts of memory, such as databases and scientific computing applications, make use of Extended Memory.

Accessing Memory Regions

  • Real Mode: In Real Mode, the CPU can directly address only up to 1 MB of memory. This mode is typically used by bootloaders and DOS.
  • Protected Mode: Introduced with the 80286 processor, Protected Mode allows access to Extended Memory and provides features like memory protection and multitasking.
  • Long Mode: Available in x86-64 processors, Long Mode allows 64-bit addressing, enabling access to a vast amount of memory beyond the 4 GB limit of 32-bit systems.

What is Memory Map?

A memory map is a representation of the layout and organization of memory in a computer system. It defines the allocation and usage of memory addresses for different purposes, such as system components, hardware devices, and software applications.

Memory Map Example

Here's a simplified view of the memory map for a typical x86 system:

Low Memory: 

Address RangeSizeDescriptionNotes
00000h - 003FFh1 KBInterrupt Vector Table (IVT)Stores 256 interrupt vectors (4 bytes each).
00400h - 004FFh256 bytesBIOS Data Area (BDA)Holds system data (e.g., equipment, keyboard status).
00500h - 07BFFh~31 KBConventional Memory (Low Memory)Used for temporary program data, stack, etc.
07C00h - 07DFFh512 bytesBootloader AreaTypically where the BIOS loads the MBR.
07E00h - 9FBFFh~607 KBUsable Conventional MemoryAvailable to programs in real mode.
9FC00h - 9FFFFh1 KBExtended BIOS Data Area (EBDA)Used for ACPI tables or other data.
A0000h - AFFFFh64 KBGraphics Memory (EGA/VGA)For video graphics in higher resolutions.
B0000h - B7FFFh32 KBMonochrome Display MemoryUsed for MDA adapters (monochrome text mode).
B8000h - BFFFFh32 KBColor Text Mode Video MemoryText mode display memory (CGA/VGA).
C0000h - C7FFFh32 KBVideo BIOSContains firmware for video hardware.
C8000h - DFFFFh96 KBOptional ROMs and Expansion CardsROMs for add-on cards (e.g., SCSI, network).
E0000h - EFFFFh64 KBReserved for System BIOS ExtensionsReserved for advanced firmware features.
F0000h - FFFFFh64 KBSystem BIOSContains motherboard BIOS and POST routines.

Memory Beyond 1 MB:

Address RangeSizeDescriptionNotes
100000h - 10FFFFh64 KBHigh Memory Area (HMA)First 64 KB above 1 MB boundary, accessible in real mode with A20 enabled.
110000h - xxxxxxVariableExtended MemoryAvailable in protected mode or beyond.
FFFF0h16 bytesReset VectorCPU starts execution here after reset.