I've been looking at the output of cat /proc/iomem
and noticed a 1 kB section of reserved addresses at the end of the first block of System RAM. At first, I thought that this was a fluke of my installation, but my research seems to indicate that it's fairly common. However, I haven't found a satisfactory explanation to why it exists. Here's an example: [CentOS Deployment Guide][1]
00000000-0009fbff : System RAM
0009fc00-0009ffff : reserved
000a0000-000bffff : Video RAM area
000c0000-000c7fff : Video ROM
000f0000-000fffff : System ROM
00100000-07ffffff : System RAM
00100000-00291ba8 : Kernel code
00291ba9-002e09cb : Kernel data
e0000000-e3ffffff : VIA Technologies, Inc. VT82C597 [Apollo VP3] e4000000-e7ffffff : PCI Bus #01
e4000000-e4003fff : Matrox Graphics, Inc. MGA G200 AGP
e5000000-e57fffff : Matrox Graphics, Inc. MGA G200 AGP
e8000000-e8ffffff : PCI Bus #01
e8000000-e8ffffff : Matrox Graphics, Inc. MGA G200 AGP
ea000000-ea00007f : Digital Equipment Corporation DECchip 21140 [FasterNet]
ea000000-ea00007f : tulip ffff0000-ffffffff : reserved
My questions:
- Why does the first block of System RAM end at 0009fbff? The page size for the system is 4 kB so shouldn't it end at xxxxxfff to make the block a multiple of page size? If the page sizes are not consistent for a resource struct, how would the OS keep track of which are 4 kB and which are smaller?
- What is the reserved section at 0009fc00? I've seen a comment about it relating to [real-mode computing][2], but I'd appreciate an explanation in this context if possible.
Thanks! I've been a long time reader of stack overflow and this is my first time as a participant :)
EDIT: The information provided by @MichaelPetch answers my second question. Reading more about the EBDA section led me to this useful article on real mode and how the segmentation granularity changes from 1 B to 4 kB: Memory Map x86
It seems to me that after switching to protected mode the address range 00000000-0009fbff were reclaimed by the kernel to use to address System RAM. This leaves me with further questions:
- In protected mode, does each of the addresses in the range designated for System RAM correspond to a 4 kB frame rather than 1 B of main memory? If that is the case, it makes sense that the range does not have to be 4 kB page aligned because each physical address now corresponds to a 4 kB frame rather than an individual byte of main memory. This would also explain why the Kernel Code and Kernel Data address ranges in the remainder of System RAM are not aligned to 4 kB.
- Why is the range 00000000-0009fbff available to the kernel for use to address main memory while the range used for the EBDA section still reserved? This may be an OS-specific question, but I was curious if there is a general OS design principle that requires that the EBDA section still be available.
- I understand from looking through resource.c, which exports the iomem_resource symbol, that /proc/iomem essentially walks a tree of resource structs that describe the address range. I'm now curious if iomem_resource is the definitive structure by which the Linux kernel manages the assignment of physical addresses. By definitive, I mean that adding a node to the tree effectively reserves that physical address range for a device. Or is iomem_resource created off of another mechanism within the kernel that actually defines physical address range assignment?