Memory Map (x86): Difference between revisions

→‎External Links: update link to archive link
[unchecked revision][unchecked revision]
(→‎"Low" memory (< 1 MiB): update EBDA limit text)
(→‎External Links: update link to archive link)
 
(5 intermediate revisions by 4 users not shown)
Line 1:
This article describes the contents of the computer's physical memory at the moment that the BIOS jumps to your bootloader code.
 
=="Low" memoryReal mode address space (< 1 MiB)==
 
When a typical x86 PC boots it will be in [[Real Mode]], with an active [[BIOS]]. During the time the CPU remains in Real Mode, IRQ0 (the clock)
Line 21:
Note: the EBDA is a variable-sized memory area (on different BIOSes). If it exists, it is always immediately below 0xA0000 in memory.
It is absolutely guaranteed to be at most 128 KiB in size. Older computers typically uses 1 KiB from 0x9FC00 - 0x9FFFF, modern firmware can be found using significantly more.
You can determine the size of the EBDA by using BIOS function [[Detecting Memory (x86)#Detecting Low Memory|INT 12h]], or (often) by examining the word at 0x40E0x413 in the BDA (see below).
Both of those methods will tell you thehow locationmuch ofconventional thememory bottomis ofusable before the EBDA.
 
It should also be noted that your bootloader code is probably loaded and running in memory at physical addresses 0x7C00 through 0x7DFF. So that memory
area is likely to also be unusable until execution has been transferred to a second stage bootloader, or to your kernel.
 
Line 34:
! end
! size
! type
! description
! colspan=2 | type
|-
! colspan=56 | LowReal Memorymode address space (the first MiB)
|-
| 0x00000000
| 0x000003FF
| 1 KiB
| RAM - partially unusable (see above)
| Real Mode IVT (Interrupt Vector Table)
| rowspan=2 | unusable in real mode
| rowspan=6 | 640 KiB RAM ("Low memory")
|-
| 0x00000400
| 0x000004FF
| 256 bytes
| RAM - partially unusable (see above)
| BDA (BIOS data area)
|-
| 0x00000500
| 0x00007BFF
| almost 3029.75 KiB
| RAM (guaranteed free for use)
| Conventional memory
| rowspan=3 | usable memory
|-
| 0x00007C00 (typical location)
| 0x00007DFF
| 512 bytes
| RAM - partially unusable (see above)
| Your OS BootSector
|-
Line 66 ⟶ 65:
| 0x0007FFFF
| 480.5 KiB
| RAM (guaranteed free for use)
| Conventional memory
|-
Line 72 ⟶ 70:
| 0x0009FFFF
| 128 KiB
| RAM - partially unusable (see above)
| EBDA (Extended BIOS Data Area)
| partially used by the EBDA
|-
| 0x000A0000
| 0x000BFFFF
| 128 KiB
| VGAVideo display memory
| Mapped hardware & Misc.mapped
| rowspan=4 | 384 KiB System / Reserved ("Upper Memory")
|-
| 0x000C0000
| 0x000C7FFF
| 32 KiB (typically)
| Video BIOS
| rowspan=3 | ROM and hardware mapped / Shadow RAM
|-
| 0x000C8000
| 0x000EFFFF
| 160 KiB (typically)
| BIOS Expansions
|-
| 0x000F0000
| 0x000FFFFF
| 38464 KiB
| Motherboard BIOS
| various (unusable)
| Video memory, ROM Area
|}
 
===BIOS Data Area (BDA)===
 
The BDA is only partially standardized, and almostmostly allrelevant thefor valuesreal storedmode thereBIOS are completely obsolete and uninterestingoperations.
The following is a partial list. See the External Links references below for more detail.
 
Line 104 ⟶ 119:
| packed bit flags for detected hardware
|-
| 0x0413 (word)
| Number of kilobytes before EBDA / unusable memory
|-
| 0x0417 (word)
| keyboard state flags
Line 134 ⟶ 152:
| last keyboard LED/Shift key state
|}
 
 
===Extended BIOS Data Area (EBDA)===
 
You may see "maps" of the EBDA if you search the web. However, those maps are for the original IBM BIOS EBDA. TheyCurrent doBIOS might use a different map. The EBDA area is not standardized.
apply to any current EBDA, used by any current BIOS. The EBDA area is not standardized. It <b>does</b> contain data that your
OS will need, but you must do a bytewise pattern search to find those tables. (See [[Plug-and-Play]].)
 
===ROM Area===
 
{| {{wikitable}}
|-
! start
! end
! size
! region/exception
! description
|-
! colspan=5 | Standard usage of the ROM Area
|-
| 0x000A0000
| 0x000BFFFF
| 128 KiB
| video RAM
| VGA display memory
|-
| 0x000C0000
| 0x000C7FFF
| 32 KiB (typically)
| ROM
| Video BIOS
|-
| 0x000C8000
| 0x000EFFFF
| 160 KiB (typically)
| ROMs and unusable space
| Mapped hardware & Misc.
|-
| 0x000F0000
| 0x000FFFFF
| 64 KiB
| ROM
| Motherboard BIOS
|}
 
=="Upper"Extended Memory (> 1 MiB)==
 
The region of RAM above 1 MiB is not standardized, well-defined, or contiguous. There are likely to be regions of it that
Line 186 ⟶ 164:
Some ACPI areas cannot be "reclaimed" this way. Some of the computer's RAM may extend above 4 GiB.
 
Use the BIOS function [[Detecting Memory (x86)#BIOS Function: INT 0x15, EAX = 0xE820|INT 15h, EAX=0xE820]] to get a reliable map of UpperExtended Memory.
 
 
Line 247 ⟶ 225:
 
===External Links===
* https://web.archive.org/web/20120130052813/http://www.nondot.org/sabre/os/files/Booting/BIOS_SEG.txt -- detailed BIOS Data Area map
* httphttps://web.archive.org/web/20221127214951/https://www.bioscentral.com/misc/bda.htm -- another detailed BIOS Data Area map
* [http://files.osdev.org/mirrors/geezer/osd/ram/index.htm#layout Geezer's memory layout description]
* http://stanislavs.org/helppc/bios_data_area.html
 
[[Category:X86]]
[[Category:Physical Memory]]
Anonymous user