Adds some memory map debugging.
This commit is contained in:
parent
b8856b977d
commit
a9ebf0326c
2 changed files with 26 additions and 8 deletions
|
@ -52,6 +52,12 @@ namespace multiboot
|
||||||
uint64_t base;
|
uint64_t base;
|
||||||
uint64_t length;
|
uint64_t length;
|
||||||
uint32_t type;
|
uint32_t type;
|
||||||
|
|
||||||
|
|
||||||
|
bool isFree() const {
|
||||||
|
return this->type == 1;
|
||||||
|
}
|
||||||
|
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
MB_ASSERT_SIZE(MemoryMap, 24);
|
MB_ASSERT_SIZE(MemoryMap, 24);
|
||||||
|
@ -62,6 +68,11 @@ namespace multiboot
|
||||||
physical_t end;
|
physical_t end;
|
||||||
const char * name;
|
const char * name;
|
||||||
uint32_t reserved;
|
uint32_t reserved;
|
||||||
|
|
||||||
|
uint32_t size() const {
|
||||||
|
return this->end.numeric() - this->start.numeric();
|
||||||
|
}
|
||||||
|
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
MB_ASSERT_SIZE(Module, 16);
|
MB_ASSERT_SIZE(Module, 16);
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
using namespace multiboot;
|
using namespace multiboot;
|
||||||
|
|
||||||
extern "C" void init(Structure const * data)
|
extern "C" void init(Structure const & data)
|
||||||
{
|
{
|
||||||
Console::main
|
Console::main
|
||||||
<< "Hello World!\n"
|
<< "Hello World!\n"
|
||||||
|
@ -18,14 +18,21 @@ extern "C" void init(Structure const * data)
|
||||||
<< "Hello default color.\n";
|
<< "Hello default color.\n";
|
||||||
|
|
||||||
Console::main
|
Console::main
|
||||||
<< "multiboot structure: 0x" << data << "\n"
|
<< "bootloader name: " << data.bootLoaderName << "\n"
|
||||||
<< "bootloader name: " << data->bootLoaderName << "\n"
|
<< "command line: " << data.commandline << "\n"
|
||||||
<< "command line: " << data->commandline << "\n"
|
<< "count of modules: " << data.modules.length << "\n"
|
||||||
<< "count of modules: " << data->modules.length << "\n";
|
<< "count of mmaps: " << data.memoryMaps.length << "\n";
|
||||||
|
for(auto &mmap : data.memoryMaps) {
|
||||||
for(const Module &module : data->modules) {
|
if(mmap.length == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
Console::main
|
Console::main
|
||||||
<< "Module " << module.name << "\n";
|
<< "mmap: "
|
||||||
|
<< (uint32_t)mmap.base << "+" << (uint32_t)mmap.length
|
||||||
|
<< ", " << mmap.entry_size
|
||||||
|
<< ", " << sizeof(mmap)
|
||||||
|
<< ", free:" << mmap.isFree()
|
||||||
|
<< "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Reference in a new issue