Multiboot 1.6 says lower memory starts at 0 and is 640 kilobytes. Upper memory starts at 1 megabyte. Lower memory seems to be "conventional memory". Now lets say because I'm not too skilled of a programmer, I want to avoid reserved memory all together and start at the 16 megabyte mark. Hopefully that's far enough along to skip GRUB modules, ISA, etc.
GRUB reports upper memory as being approximately 129 megabytes (for 128 RAM on QEMU) and 130 megabytes (for 1024 RAM on QEMU). In the memory map itself, the available RAM starts at the 16 meg mark and has a length approximately higher than the amount of RAM I set for QEMU (i.e., 1072 megabytes.) Furthermore, the memory map wiki page calls this area "Extended memory".
Terminology seems to be all over the place. The wikipedia pages for lower, upper, and extended memory (maybe it's just talking about DOS I don't know) is talking about memory that's below the 16 megabyte mark. But the wiki seems to inconsistently use terminology to refer to memory that's above lower memory.
1. Can someone explain what "upper memory" is?
2. If upper memory is reported as 130 megabytes, should I start at 130 megabytes instead of 16 megabytes to avoid reserved areas?
What does "upper memory" mean?
Re: What does "upper memory" mean?
Hi,
Conventional memory was all memory below 1 MiB. Extended memory is all memory above 1 MiB (and includes the "not quite 64 KiB" upper memory area).
There was also "expanded memory" that was switched into the lower 1 MiB using bank switching. It was ugly (but worked around the ~ 1 MiB real mode limit). Fortunately expanded memory became obsolete when software started supporting extended memory properly.
The "upper memory" in multi-boot's specs actually means "extended memory" and not "upper memory".
Note that the upper/lower memory fields are obsolete junk dating back to a time before "int 0x15, eax=0xE820" existed; and you shouldn't use these fields unless the "mmap" fields don't exist. The "mmap" fields do (should) describe all the memory areas properly.
Cheers,
Brendan
It shouldn't. This area is nearly always less than 640 KiB because of space consumed by the EBDA (Extended BIOS Data Area).iamnoob wrote:Multiboot 1.6 says lower memory starts at 0 and is 640 kilobytes.
Originally (8086) the CPU could only access 1 MiB. Later CPUs (80286) were able to access more, but existing OSs at the time (MS-DOS) were stuck in real mode. Someone realised that with real mode segmentation (and with A20 enabled) you could access more than 1 MiB (e.g. starting at real mode address 0xFFFF:0x0010). This 65520 byte area became known as "upper memory".iamnoob wrote:1. Can someone explain what "upper memory" is?
Conventional memory was all memory below 1 MiB. Extended memory is all memory above 1 MiB (and includes the "not quite 64 KiB" upper memory area).
There was also "expanded memory" that was switched into the lower 1 MiB using bank switching. It was ugly (but worked around the ~ 1 MiB real mode limit). Fortunately expanded memory became obsolete when software started supporting extended memory properly.
The "upper memory" in multi-boot's specs actually means "extended memory" and not "upper memory".
If extended memory is reported as 130 MiB (by the "upper memory" field in multiboot); then there's at least 130 MiB of usable RAM starting at 0x00100000. There may be more elsewhere.iamnoob wrote:2. If upper memory is reported as 130 megabytes, should I start at 130 megabytes instead of 16 megabytes to avoid reserved areas?
Note that the upper/lower memory fields are obsolete junk dating back to a time before "int 0x15, eax=0xE820" existed; and you shouldn't use these fields unless the "mmap" fields don't exist. The "mmap" fields do (should) describe all the memory areas properly.
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: What does "upper memory" mean?
I always get memory maps that report 512 KiB free starting at address 0 (that's expected) and then free RAM starting at 0x100000 that's length around the RAM parameter passed to QEMU. The problem is others have suggested that this is faulty because it doesn't show everything (like 0xA000). But if everything up to 16 meg is reported as reserved by the memory map anyway, can I just ignore the memory map and start using memory there?If extended memory is reported as 130 MiB (by the "upper memory" field in multiboot); then there's at least 130 MiB of usable RAM starting at 0x00100000. There may be more elsewhere.
Note that the upper/lower memory fields are obsolete junk dating back to a time before "int 0x15, eax=0xE820" existed; and you shouldn't use these fields unless the "mmap" fields don't exist. The "mmap" fields do (should) describe all the memory areas properly.
Re: What does "upper memory" mean?
Hi,
I'd be more worried about always reporting 512 KiB of usable RAM starting at address 0. For simple computers (without a lot of CPUs, etc) the EBDA is typically 1 KiB, and there should be 639 KiB of usable RAM starting at address 0.
However; I would expect 512 KiB if you boot from network with PXE, because PXE steals some RAM for its own use. I'd also expect 512 KiB on some ancient 8086 machines (but I'd also expect GRUB to crash or hang on anything that old without so much as a nice "CPU is too old" error message to indicate why).
Mostly; I'd expect something like this:
Cheers,
Brendan
The memory map shouldn't include areas used by memory mapped devices (including the video card's legacy VGA area at 0x000A0000); but should include special areas used by the motherboard/firmware (including the SMM area which is typically hidden underneath the VGA area at 0x000A0000). Whether or not Qemu's memory map is correct depends on where their SMM area is; but I suspect that Qemu doesn't emulate SMM properly and doesn't have an SMM area, and therefore Qemu's memory map would be correct.iamnoob wrote:I always get memory maps that report 512 KiB free starting at address 0 (that's expected) and then free RAM starting at 0x100000 that's length around the RAM parameter passed to QEMU. The problem is others have suggested that this is faulty because it doesn't show everything (like 0xA000).
I'd be more worried about always reporting 512 KiB of usable RAM starting at address 0. For simple computers (without a lot of CPUs, etc) the EBDA is typically 1 KiB, and there should be 639 KiB of usable RAM starting at address 0.
However; I would expect 512 KiB if you boot from network with PXE, because PXE steals some RAM for its own use. I'd also expect 512 KiB on some ancient 8086 machines (but I'd also expect GRUB to crash or hang on anything that old without so much as a nice "CPU is too old" error message to indicate why).
Mostly; I'd expect something like this:
- 0x0000000000000000 to 0x000000000009FBFF = usable RAM
0x000000000009FC00 to 0x000000000009FFFF = reserved (EBDA)
(gap for legacy video)
0x00000000000C0000 to 0x00000000000FFFFF = reserved (firmware and device ROMs)
0x0000000000100000 to 0x00000000???????? = usable RAM (extended memory)
0x00000000???????? to 0x00000000???????? = "ACPI reclaimable" area
(gap for PCI devices, etc)
0x00000000???????? to 0x00000000FFFFFFFF = reserved (actual firmware ROM)
0x0000000100000000 to 0x???????????????? = usable RAM (if the computer has more than about 3 GiB of RAM)
If everything up to 0x01000000 is reported as reserved; then your RAM, firmware, bootloader or OS is most likely faulty/broken/dodgy. Otherwise, you still need to know how much usable RAM is at 0x01000000 or anywhere else and can't ignore the memory map.iamnoob wrote:But if everything up to 16 meg is reported as reserved by the memory map anyway, can I just ignore the memory map and start using memory there?
Cheers,
Brendan
For all things; perfection is, and will always remain, impossible to achieve in practice. However; by striving for perfection we create things that are as perfect as practically possible. Let the pursuit of perfection be our guide.
Re: What does "upper memory" mean?
I just checked Grub 0.97's source code and it actually grabs the value for low memory from the memory map (E820). It will report less than 640 KB if the memory map takes the EBDA into account. Grub also corrects the BDA entry to make sure it is consistent with the memory map.Brendan wrote:It shouldn't. This area is nearly always less than 640 KiB because of space consumed by the EBDA (Extended BIOS Data Area).iamnoob wrote:Multiboot 1.6 says lower memory starts at 0 and is 640 kilobytes.