I have only given a quick glance. I doubt this is the only problem but:
Code:
uint32_t get_memory_size(multiboot_info_t* mbd) {
uint32_t lower = mbd->mem_lower;
uint32_t higher = mbd->mem_upper;
return lower + higher;
}
That isn't right, if you're trying to calculate the highest possible address, which is what you appear to treat the returned value as. From the spec:
Quote:
Lower memory starts at address 0, and upper memory starts at address 1 megabyte
I.e. the return should be mem_upper + 1MB, the lower memory amount doesn't even enter the equation. However I should add that using these is over-simplistic anyway, you should really use the full memory map (although I guess you could use these values just to get started). Note that:
Quote:
The value returned for upper memory is maximally the address of the first upper memory hole minus 1 megabyte. It is not guaranteed to be this value.
I.e. mem_upper only goes so far as the first memory hole and might not even go that far, so it may report far less memory than is actually available.