venus.w
venus.w

Reputation: 2251

how does the OS know the real size of the physical memory?

When the OS is loaded at the moment the computer is started, how does the OS know the hardware information, is there some io instruction or the booter program get information from the bios.??

Upvotes: 9

Views: 2580

Answers (3)

Jonas Engström
Jonas Engström

Reputation: 5065

An OS that boot from a BIOS-based system query the Query System Address Map function using INT 0x15, AX=0xE820.

A UEFI-based OS would typically get the physical memory map using the GetMemoryMap() interface.

Upvotes: 7

On machines like desktop or laptop PCs, the amount of memory is given to the OS by the BIOS or the UEFI

Upvotes: 3

user1202136
user1202136

Reputation: 11547

The motherboard firmware (also called BIOS, ACPI interface or EFI) allows the OS to find out the physical mapping of RAM and ROM in the system.

For example, this is the output of a booting Linux:

[    0.000000] BIOS-provided physical RAM map:
[    0.000000]  BIOS-e820: 0000000000000000 - 0000000000098c00 (usable)
[    0.000000]  BIOS-e820: 0000000000098c00 - 00000000000a0000 (reserved)
[    0.000000]  BIOS-e820: 00000000000e6000 - 0000000000100000 (reserved)
[    0.000000]  BIOS-e820: 0000000000100000 - 00000000bfea0000 (usable)
[    0.000000]  BIOS-e820: 00000000bfeae000 - 00000000bfeb0000 type 9
[    0.000000]  BIOS-e820: 00000000bfeb0000 - 00000000bfec0000 (ACPI data)
[    0.000000]  BIOS-e820: 00000000bfec0000 - 00000000bfef0000 (ACPI NVS)
[    0.000000]  BIOS-e820: 00000000bfef0000 - 00000000c0000000 (reserved)
[    0.000000]  BIOS-e820: 00000000ffc00000 - 0000000100000000 (reserved)
[    0.000000]  BIOS-e820: 0000000100000000 - 0000000c40000000 (usable)

Upvotes: 11

Related Questions