I would like help with the following issue.
I'm following Multiboot2 specification (https://www.gnu.org/software/grub/manua ... iboot.html)
What I'm doing is checking the addresses of the memory map entries inside GDB's register dump:
Code: Select all
uint64_t main(uint32_t magic, uint32_t mbi) {
. . . .
if(tag->type == MBOOT_TAG_MMAP){
struct mboot_mmap *mmap = (struct mboot_mmap *)tag;
struct mboot_mmap_entry *entry = mmap->entries;
i=0;
while((uint32_t)entry < (uint32_t)mmap + mmap->size){
i++;
if(i==2) return entry->base_addr;
entry = (struct mboot_mmap_entry *)((uint32_t)entry + mmap->entry_size);
}
. . . .
The issue is that all the entry's base addresses are being returned as 0. (Tried for all possible values of i)
I'm supplying 32MB of RAM from qemu and basic memory information (mem_lower and mem_upper values are being returned correctly - around 639KB for mem_lower and around 31.5 MB for mem_upper)
And entry->type is also returning 0 !! (even for 1st entry). This is driving me crazy
Structures for mmap and mmap_entry are as follows:
Code: Select all
struct mboot_mmap_entry {
mboot64_t base_addr;
mboot64_t length;
#define MBOOT_MEMORY_AVAILABLE 1
#define MBOOT_MEMORY_RESERVED 2
#define MBOOT_MEMORY_ACPI_RECLAIMABLE 3
#define MBOOT_MEMORY_NVS 4
#define MBOOT_MEMORY_BADRAM 5
mboot32_t type;
mboot32_t zero;
};
struct mboot_mmap {
mboot32_t type;
mboot32_t size;
mboot32_t entry_size;
mboot32_t entry_type;
mboot32_t entry_version;
struct mboot_mmap_entry entries[0];
};
Thanks