54 LOG_INFO(
"PHYS",
"memory entries %d", ctx->memory.memory_entries);
56 memory_entry_t* smallest_entry =
NULL;
58 for (
register uint64_t i = 0; i < ctx->memory.memory_entries; i++) {
59 memory_entry_t* entry = &ctx->memory.memory_map[i];
71 for (
uint64_t i = 0; i < ctx->memory.memory_entries; i++) {
72 memory_entry_t* entry = &ctx->memory.memory_map[i];
77 if (entry->base > 0) {
78 if (entry->base < smalest_base1) {
79 smalest_base2 = smalest_base1;
80 smalest_base1 = entry->base;
81 }
else if (entry->base < smalest_base2
82 && entry->base != smalest_base1) {
83 smalest_base2 = entry->base;
84 smallest_entry = entry;
90 LOG_INFO(
"PHYS",
"smalest base 1 : 0x%x", smalest_base1);
91 LOG_INFO(
"PHYS",
"smalest base 2 : 0x%x", smalest_base2);
93 if (smallest_entry ==
NULL) {
94 LOG_ERROR(
"PHYS",
"failed to find DMA region");
100 smallest_entry->length / 1024);
109 for (
uint64_t i = 0; i < ctx->memory.memory_entries; i++) {
110 memory_entry_t* entry = &ctx->memory.memory_map[i];
115 "found suitale place for metadata 0x%x length "
117 entry->base, entry->length / 1024);
130 for (
uint64_t i = 0; i < ctx->memory.memory_entries; i++) {
131 memory_entry_t* entry = &ctx->memory.memory_map[i];
136 uint64_t metadata_index = entry->base / 0x1000;
137 uint64_t metadata_end = entry->length / 0x1000;
139 j < (metadata_index + metadata_end); j++) {
158 LOG_INFO(
"MEMORY",
"found smallest entry at index %d",
165 LOG_INFO(
"MEMORY",
"usable memory size : %d mb",
167 for (
uint64_t i = 0; i < ctx->memory.memory_entries; i++) {
168 memory_entry_t* entry = &ctx->memory.memory_map[i];
170 "entry %d base 0x%x -- 0x%x length %d (%d Kb) type %s",
171 i, entry->base, entry->base + entry->length,
172 entry->length, entry->length / 1024,
@ ENTRY_MMAP_ACPI_RECLAIMABLE
@ ENTRY_MMAP_KERNEL_AND_MODULES
@ ENTRY_MMAP_BOOTLOADER_RECLAIMABLE