[SeaBIOS] [PATCH] Minor - simplify rom_reserve().

Kevin O'Connor kevin at koconnor.net
Sat Aug 17 16:10:58 CEST 2013


Signed-off-by: Kevin O'Connor <kevin at koconnor.net>
---
 src/pmm.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/src/pmm.c b/src/pmm.c
index 1c8da1e..9ea4313 100644
--- a/src/pmm.c
+++ b/src/pmm.c
@@ -348,17 +348,14 @@ rom_get_last(void)
 struct rom_header *
 rom_reserve(u32 size)
 {
-    if (!CONFIG_MALLOC_UPPERMEMORY) {
-        if (RomEnd + size > rom_get_max())
-            return NULL;
-        return (void*)RomEnd;
-    }
-    u32 newend = ALIGN(RomEnd + size, OPTION_ROM_ALIGN) + OPROM_HEADER_RESERVE;
-    if (newend > (u32)RomBase->allocend)
+    u32 newend = ALIGN(RomEnd + size, OPTION_ROM_ALIGN);
+    if (newend > rom_get_max())
         return NULL;
-    if (newend < (u32)zonelow_base + OPROM_HEADER_RESERVE)
-        newend = (u32)zonelow_base + OPROM_HEADER_RESERVE;
-    RomBase->data = RomBase->dataend = (void*)newend;
+    if (CONFIG_MALLOC_UPPERMEMORY) {
+        if (newend < (u32)zonelow_base)
+            newend = (u32)zonelow_base;
+        RomBase->data = RomBase->dataend = (void*)newend + OPROM_HEADER_RESERVE;
+    }
     return (void*)RomEnd;
 }
 
-- 
1.7.11.7




More information about the SeaBIOS mailing list