20 #include "pedigree/kernel/BootstrapInfo.h" 21 #include "pedigree/kernel/compiler.h" 22 #include "pedigree/kernel/processor/types.h" 34 BootstrapStruct_t::BootstrapStruct_t()
39 bool BootstrapStruct_t::isInitrdLoaded()
const 41 if (flags & MULTIBOOT_FLAG_MODS)
42 return (mods_count != 0);
47 uint8_t *BootstrapStruct_t::getInitrdAddress()
const 49 if (flags & MULTIBOOT_FLAG_MODS)
50 return reinterpret_cast<uint8_t *
>(getModuleArray()[0].base);
55 size_t BootstrapStruct_t::getInitrdSize()
const 57 if (flags & MULTIBOOT_FLAG_MODS)
58 return getModuleArray()[0].end - getModuleArray()[0].base;
63 bool BootstrapStruct_t::isDatabaseLoaded()
const 65 if (flags & MULTIBOOT_FLAG_MODS)
66 return (mods_count > 1);
71 uint8_t *BootstrapStruct_t::getDatabaseAddress()
const 73 if (flags & MULTIBOOT_FLAG_MODS)
74 return reinterpret_cast<uint8_t *
>(getModuleArray()[1].base);
79 size_t BootstrapStruct_t::getDatabaseSize()
const 81 if (flags & MULTIBOOT_FLAG_MODS)
82 return getModuleArray()[1].end - getModuleArray()[1].base;
87 char *BootstrapStruct_t::getCommandLine()
const 89 if (flags & MULTIBOOT_FLAG_CMDLINE)
90 return reinterpret_cast<char *
>(cmdline);
95 size_t BootstrapStruct_t::getSectionHeaderCount()
const 97 if (flags & MULTIBOOT_FLAG_ELF)
103 size_t BootstrapStruct_t::getSectionHeaderEntrySize()
const 105 if (flags & MULTIBOOT_FLAG_ELF)
111 size_t BootstrapStruct_t::getSectionHeaderStringTableIndex()
const 113 if (flags & MULTIBOOT_FLAG_ELF)
119 uintptr_t BootstrapStruct_t::getSectionHeaders()
const 121 if (flags & MULTIBOOT_FLAG_ELF)
127 void *BootstrapStruct_t::getMemoryMap()
const 129 if (flags & MULTIBOOT_FLAG_MMAP)
130 return reinterpret_cast<void *
>(mmap_addr);
135 uint64_t BootstrapStruct_t::getMemoryMapEntryAddress(
void *opaque)
const 141 return entry->address;
144 uint64_t BootstrapStruct_t::getMemoryMapEntryLength(
void *opaque)
const 150 return entry->length;
153 uint32_t BootstrapStruct_t::getMemoryMapEntryType(
void *opaque)
const 162 void *BootstrapStruct_t::nextMemoryMapEntry(
void *opaque)
const 168 uintptr_t entry_addr =
reinterpret_cast<uintptr_t
>(opaque);
169 void *new_opaque =
reinterpret_cast<void *
>(entry_addr + entry->size + 4);
171 if (reinterpret_cast<uintptr_t>(new_opaque) >= (mmap_addr + mmap_length))
177 size_t BootstrapStruct_t::getModuleCount()
const 179 if (flags & MULTIBOOT_FLAG_MODS)
185 void *BootstrapStruct_t::getModuleBase()
const 187 if (flags & MULTIBOOT_FLAG_MODS)
188 return reinterpret_cast<void *
>(mods_addr);