User:Johnburger/Demo/BIOS/RAMMap

From OSDev Wiki
Jump to navigation Jump to search

The BIOS is about the only thing that can know how the PC's RAM is set up, since it's the code that set it up in the first place. The RAMMap BIOS function reports the memory address space layout through a series of calls.

Demo/BIOS/RAMMap.inc

;
; BIOS/RAMMap.inc
;

; These are the definitions for the BIOS RAM Map information handler

BIOS.RAMMap.Int EQU             15h
BIOS.RAMMap.Fn  EQU             0000_E820h
BIOS.RAMMap.Magic EQU           "PAMS"          ; NASM reverses "SMAP"

; This is the BIOS RAMMap structure
                STRUC           BIOS.RAMMap
.Base           RESQ            1
.Length         RESQ            1
.Type           RESD            1
.Flags          RESD            1 ; Added in later BIOSes
                ENDSTRUC

BIOS.RAMMap.Flags.DontIgnore EQU 0000_0000_0000_0001b