CLOSE

After the BIOS transfers control to boot sector, the first megabyte of memory looks like this:

Address:  
Segment:Offset
SizeName
0x0000:0x00001024 bytesInterrupt Vector Table
0x0040:0x0000256 bytesBIOS Data Area
0x0050:0x0000?Free memory
0x07C0:0x0000512 bytesBoot sector code
0x07E0:0x0000?Free memory
0xA000:0x000064 KbGraphics Video Memory
0xB000:0x000032 KbMonochrome Text Video Memory
0xB800:0x000032 KbColor Text Video Memory
0xC000:0x0000256 Kb1ROM Code Memory
0xFFFF:0x000016 bytesMore BIOS data
x86 Memory Map - Wayne's Talk

BIOS Data Area (BDA)

The BIOS Data Area (BDA) is a reserved region of memory in IBM PC-compatible computers, typically located in the first 1 KB of conventional memory, starting at physical address 0x400. This area is used by the BIOS (Basic Input/Output System) to store various system parameters and configuration data that are crucial for hardware and system functionality. The BDA is established during the system's power-on self-test (POST) and is used by both the BIOS and the operating system to access hardware information.

  • It is used to store important system information.
  • The BDA provides a standardized way to store and access various hardware and configuration parameters necessary for the BIOS, operating system, and certain applications.

Why the BIOS Data Area Exists

The BDA exists to provide a reliable and consistent location for storing critical system information that needs to be accessed by both the BIOS and the operating system. This design ensures that hardware configuration and status information is available from the moment the system boots until it is powered down or reset.

Key Uses of the BIOS Data Area

  1. Storing Hardware Configuration: Information about the system's hardware configuration, such as the number of disk drives, keyboard status, and display configuration, is stored in the BDA.
  2. System Timing: Timer and clock-related data are maintained in this area to manage system time and delays.
  3. Communication Ports: The addresses and statuses of serial (COM) and parallel (LPT) ports are stored in the BDA.
  4. Memory Size: The amount of conventional memory and extended memory is recorded in the BDA.
  5. Boot Information: It can store boot-related information and status flags used during the boot process.

Structure of the BIOS Data Area

The BDA starts at physical address 0x400 (segment 0x40 in real mode) and occupies 256 bytes (0x400 to 0x4FF). Here is a detailed breakdown of the BDA structure with some key offsets and the data they store:

OffsetLength (bytes)Description
0x4002COM1 I/O port address
0x4022COM2 I/O port address
0x4042COM3 I/O port address
0x4062COM4 I/O port address
0x4082LPT1 I/O port address
0x40A2LPT2 I/O port address
0x40C2LPT3 I/O port address
0x40E2LPT4 I/O port address
0x4101Installed equipment list flags.
Provides hardware configuration flags (e.g., floppy drives, coprocessor availability).
0x4112Base memory size (in KB)
0x4132Address of keyboard buffer head
0x4152Address of keyboard buffer tail
0x41732Keyboard buffer
0x4411Current display mode
0x4501RTC status register B
0x4602Extended memory size (in KB)
0x4622CMOS reset flag
0x4632POST status (BIOS use)
0x4671Last key scan code
0x47A2Status flags for the BIOS data area
0x4807Reserved for IBM use
0x4842Number of hard disks
0x4F016Reserved for IBM use

For more information visit here: https://github.com/oblivia-simplex/cmoskit/blob/master/Bios_Information_Leakage.txt

What the BIOS Data Area Stores

1 Communication Port Addresses:

The BDA stores the base I/O port addresses for the serial and parallel ports, allowing software to communicate with these devices:

  • COM Port Addresses:
    • Stores the base I/O addresses for up to four serial ports.
    • Address: 0x400
      • COM1: 0x400
      • COM2: 0x402
      • COM3: 0x404
      • COM4: 0x406
  • LPT Port Address:
    • Stores the base I/O addresses for up to three parallel ports.
    • Address: 0x408
      • LPT1: 0x408
      • LPT2: 0x40A
      • LPT3: 0x40C
      • LPT4: 0x40E

2 Installed Equipment List:

The equipment list flag at offset 0x410 provides information about the hardware installed on the system, such as the presence of disk drives, display modes, and other peripherals.

  • Indicates connected hardware, such as:
    • Number of installed floppy drives.
    • Availability of a math coprocessor.
    • Presence of a serial/parallel port.
  • Address: 00410h

3 Memory Size:

Offsets 0x411 and 0x460 store the size of conventional and extended memory, respectively. This information is crucial for memory management by the operating system:

  • Base memory size: 0x411 (in KB)
  • Extended memory size: 0x460 (in KB)

3 Keyboard Buffer:

The BDA includes a keyboard buffer starting at offset 0x417, which stores keystrokes before they are processed by the operating system:

  • Keyboard buffer head: 0x413
  • Keyboard buffer tail: 0x415
  • Keyboard buffer: 0x417 (32 bytes)
  • Tracks the state of the keyboard, such as:
    • Shift, Ctrl, and Alt key states.
    • Lock key states (Caps Lock, Num Lock, Scroll Lock).
  • Address: 00417h

4 Display Mode:

Offset 0x441 stores the current display mode, which is used by the BIOS and operating system to configure the video display properly.

5 RTC and Status Flags:

The Real-Time Clock (RTC) status register B at offset 0x450 and various status flags at other offsets store time-related information and system status flags that are important for system timing and control.

References