简体   繁体   中英

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

当计算机启动时加载操作系统时,操作系统如何知道硬件信息,是否有一些io指令或引导程序从BIOS中获取信息。

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)

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.

在台式机或笔记本电脑等机器上, BIOSUEFI会为操作系统提供内存量

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM