Hello,everyone.
I'm writing a kernel which can be booted by Grub.
Can U tell me how to get memory info(mem size etc.) from Grub.
I have placed the multiboot code in my kernel:
MBOOT_PAGE_ALIGN equ 1<<0
MBOOT_MEM_INFO equ 1<<1
MBOOT_HEADER_MAGIC equ 0x1BADB002
MBOOT_HEADER_FLAGS equ MBOOT_PAGE_ALIGN | MBOOT_MEM_INFO
MBOOT_CHECKSUM equ -(MBOOT_HEADER_MAGIC + MBOOT_HEADER_FLAGS)
How to get meminfo from Grub?
All the information is in the Multiboot specification: http://www.gnu.org/software/grub/manual ... ion-format.
When your kernel starts, [ebx+4] contains the amount of lower memory (which will normally be 640KB), and [ebx+8] contains the amount of upper memory (memory that starts at address 1MB). Both amounts are in kilobytes.
When your kernel starts, [ebx+4] contains the amount of lower memory (which will normally be 640KB), and [ebx+8] contains the amount of upper memory (memory that starts at address 1MB). Both amounts are in kilobytes.
Thx for your reply, I think I've got what I want.nick8325 wrote:All the information is in the Multiboot specification: http://www.gnu.org/software/grub/manual ... ion-format.
When your kernel starts, [ebx+4] contains the amount of lower memory (which will normally be 640KB), and [ebx+8] contains the amount of upper memory (memory that starts at address 1MB). Both amounts are in kilobytes.
Can you tell me the details (or where can I get it) about parsing the memory map?karekare0 wrote:But also, I'd advise parsing the detailed memory map instead, to be wary about random holes in memory.
However, this may not be available on older computers, so the lower/upper memory option may be the only possible way.
Thx..
Well, the values are up to the first memory hole, so the memory itself is guaranteed safe to use. It's however very well possible that there is more memory to use (and on modern machines it's almost certain).karekare0 wrote:But also, I'd advise parsing the detailed memory map instead, to be wary about random holes in memory. :wink:
JAL