boot: yboot protocol change: memory map

Memory map is now a part of boot protocol structure.
The change was caused by UEFI placing this boot structure
(as part of yboot's data section) very high in physical memory,
above kernel's mapped 4GiB range, so kernel had no way of
accessing it. It's not the best solution, but will work for sure.
This commit is contained in:
Mark
2020-09-05 02:08:52 +03:00
parent fb7e385a05
commit c3f23032f0
2 changed files with 3 additions and 7 deletions
+1 -1
View File
@@ -10,7 +10,6 @@ yboot_data:
.quad BOOT_KERNEL_MAGIC // kernel_magic
.quad 0 // loader_magic
.quad 0 // memory_map_base
.long 0 // memory_map_size
.long 0 // memory_map_entsize
@@ -32,6 +31,7 @@ yboot_data:
.quad 0 // rsdp
.skip 256 // cmdline
.skip 3072 // memory map data
.size yboot_data, . - yboot_data
.section .text
+2 -6
View File
@@ -153,7 +153,6 @@ struct boot_struct {
uint64_t kernel_magic; // R
uint64_t loader_magic; // W
uint64_t memory_map_base; // W
uint32_t memory_map_size; // W
uint32_t memory_map_entsize; // W
@@ -176,16 +175,13 @@ struct boot_struct {
uint64_t rsdp; // W
char cmdline[256]; // W
char memory_map_data[3072]; // W
} __attribute__((packed));
#endif
static void entry_yboot(void) {
extern struct boot_struct yboot_data;
if (yboot_data.memory_map_base == 0) {
panic("No memory map available\n");
}
if (yboot_data.rsdp == 0) {
kwarn("Booted from UEFI and no RSDP was provided, will likely result in error\n");
} else {
@@ -204,7 +200,7 @@ static void entry_yboot(void) {
}
phys_memory_map.format = MM_PHYS_MMAP_FMT_YBOOT;
phys_memory_map.address = (void *) MM_VIRTUALIZE(yboot_data.memory_map_base);
phys_memory_map.address = yboot_data.memory_map_data;
phys_memory_map.entry_size = yboot_data.memory_map_entsize;
phys_memory_map.entry_count = yboot_data.memory_map_size / yboot_data.memory_map_entsize;
}