Adds some memory map debugging.

This commit is contained in:
Felix Queißner 2016-05-04 16:33:59 +02:00
parent b8856b977d
commit a9ebf0326c
2 changed files with 26 additions and 8 deletions

View file

@ -52,6 +52,12 @@ namespace multiboot
uint64_t base;
uint64_t length;
uint32_t type;
bool isFree() const {
return this->type == 1;
}
} __attribute__((packed));
MB_ASSERT_SIZE(MemoryMap, 24);
@ -62,6 +68,11 @@ namespace multiboot
physical_t end;
const char * name;
uint32_t reserved;
uint32_t size() const {
return this->end.numeric() - this->start.numeric();
}
} __attribute__((packed));
MB_ASSERT_SIZE(Module, 16);

View file

@ -9,7 +9,7 @@
using namespace multiboot;
extern "C" void init(Structure const * data)
extern "C" void init(Structure const & data)
{
Console::main
<< "Hello World!\n"
@ -18,14 +18,21 @@ extern "C" void init(Structure const * data)
<< "Hello default color.\n";
Console::main
<< "multiboot structure: 0x" << data << "\n"
<< "bootloader name: " << data->bootLoaderName << "\n"
<< "command line: " << data->commandline << "\n"
<< "count of modules: " << data->modules.length << "\n";
for(const Module &module : data->modules) {
<< "bootloader name: " << data.bootLoaderName << "\n"
<< "command line: " << data.commandline << "\n"
<< "count of modules: " << data.modules.length << "\n"
<< "count of mmaps: " << data.memoryMaps.length << "\n";
for(auto &mmap : data.memoryMaps) {
if(mmap.length == 0) {
continue;
}
Console::main
<< "Module " << module.name << "\n";
<< "mmap: "
<< (uint32_t)mmap.base << "+" << (uint32_t)mmap.length
<< ", " << mmap.entry_size
<< ", " << sizeof(mmap)
<< ", free:" << mmap.isFree()
<< "\n";
}
/*