GRUB memory map has little memory

Question about which tools to use, bugs, the best way to implement a function, etc should go here. Don't forget to see if your question is answered in the wiki first! When in doubt post here.
Post Reply
shervingav
Posts: 11
Joined: Sun May 11, 2014 6:19 am
Location: Iran

GRUB memory map has little memory

Post by shervingav »

Hi,
i am getting the memory map from grub and it seems most of my ram is either corrupted or reserved.
these are the addresses that grub gives me:( i have 4 GBytes of ram )
0x00000000 ------------> 0x0009FC00
0x00100000 ------------> 0x07FFE000

this is part of my code that gets memory map:

Code: Select all

void get_ram(multiboot_info_t* mbd, unsigned int magic){
    if ( CHECK_BIT(mbd->flags, 6) ){
        uint32 addr = mbd->mmap_addr, len = mbd->mmap_length;
        memory_map_t* mmap = mbd->mmap_addr;
        ndosiz = 0;
        while(mmap < addr + len){
            struct Node_list nd; // just a simple pair
            if( mmap->type == 1 ){
                nod[nodsiz].s = mmap->base_addr_low; // Array for storing the addresses
                nod[nodsiz].t = mmap->base_addr_low + mmap->length_low;
                nodsiz++;
            }
            mmap = (memory_map_t*) ( (unsigned int)mmap + mmap->size + sizeof(unsigned int) );
        }
    }
}
hope someone can help me.
"Sometimes it is the people who no one imagines anything of, who do the things that no one can IMAGINE."
_Alan Turing
gerryg400
Member
Member
Posts: 1801
Joined: Thu Mar 25, 2010 11:26 pm
Location: Melbourne, Australia

Re: GRUB memory map has little memory

Post by gerryg400 »

The base address and length are 64 bit numbers. Are you treating them as such ?
If a trainstation is where trains stop, what is a workstation ?
User avatar
Combuster
Member
Member
Posts: 9301
Joined: Wed Oct 18, 2006 3:45 am
Libera.chat IRC: [com]buster
Location: On the balcony, where I can actually keep 1½m distance
Contact:

Re: GRUB memory map has little memory

Post by Combuster »

Even if your real computer has 4GB of ram doesn't mean your emulator isn't still set to its default of 128MB.
"Certainly avoid yourself. He is a newbie and might not realize it. You'll hate his code deeply a few years down the road." - Sortie
[ My OS ] [ VDisk/SFS ]
Post Reply