bug-hurd
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] biosmem: Round down to nearest page memory map entries


From: Damien Zammit
Subject: [PATCH] biosmem: Round down to nearest page memory map entries
Date: Sat, 12 Feb 2022 22:01:01 +0000

This fixes incorrect handling of page 0x9f000, for example,
when the end offset in the e820 memory map is set to 0x9fc00.

---
 i386/i386at/biosmem.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/i386/i386at/biosmem.c b/i386/i386at/biosmem.c
index 4f0914ca..44983ead 100644
--- a/i386/i386at/biosmem.c
+++ b/i386/i386at/biosmem.c
@@ -263,8 +263,8 @@ biosmem_map_build(const struct multiboot_raw_info *mbi)
     end = entry + BIOSMEM_MAX_MAP_SIZE;

     while ((mb_entry < mb_end) && (entry < end)) {
-        entry->base_addr = mb_entry->base_addr;
-        entry->length = mb_entry->length;
+        entry->base_addr = vm_page_trunc (mb_entry->base_addr);
+        entry->length = vm_page_trunc (entry->base_addr + mb_entry->length) - 
entry->base_addr;
         entry->type = mb_entry->type;

         mb_entry = (void *)mb_entry + sizeof(mb_entry->size) + mb_entry->size;
--
2.34.1





reply via email to

[Prev in Thread] Current Thread [Next in Thread]