[syslinux:firmware] movebits: Add SMT_TERMINAL - a last resort region type

syslinux-bot for Matt Fleming matt.fleming at intel.com
Thu Jul 18 05:00:08 PDT 2013


Commit-ID:  ba638fd9bf72b0c786c88909014136cfa641a147
Gitweb:     http://www.syslinux.org/commit/ba638fd9bf72b0c786c88909014136cfa641a147
Author:     Matt Fleming <matt.fleming at intel.com>
AuthorDate: Tue, 16 Jul 2013 22:16:11 +0100
Committer:  Matt Fleming <matt.fleming at intel.com>
CommitDate: Wed, 17 Jul 2013 18:29:16 +0100

movebits: Add SMT_TERMINAL - a last resort region type

Some memory regions are usable, but only as a last resort just before we
hand over control to a kernel image. Add the necessary movebits
infrastructure to use these regions when all other options have been
exhausted.

Signed-off-by: Matt Fleming <matt.fleming at intel.com>

---
 com32/include/syslinux/movebits.h | 1 +
 com32/lib/syslinux/movebits.c     | 2 +-
 com32/lib/syslinux/zonelist.c     | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/com32/include/syslinux/movebits.h b/com32/include/syslinux/movebits.h
index feeab3a..d5c903a 100644
--- a/com32/include/syslinux/movebits.h
+++ b/com32/include/syslinux/movebits.h
@@ -35,6 +35,7 @@ enum syslinux_memmap_types {
     SMT_RESERVED,		/* Unusable memory */
     SMT_ALLOC,			/* Memory allocated by user */
     SMT_ZERO,			/* Memory that should be zeroed */
+    SMT_TERMINAL,		/* Memory to be used as a last resort */
 };
 
 struct syslinux_memmap {
diff --git a/com32/lib/syslinux/movebits.c b/com32/lib/syslinux/movebits.c
index 7a05f3c..8ffdc63 100644
--- a/com32/lib/syslinux/movebits.c
+++ b/com32/lib/syslinux/movebits.c
@@ -160,7 +160,7 @@ static const struct syslinux_memmap *is_free_zone(const struct syslinux_memmap
 	if (list->start <= start) {
 	    if (llast >= last) {
 		/* Chunk has a single, well-defined type */
-		if (list->type == SMT_FREE) {
+		if (list->type == SMT_FREE || list->type == SMT_TERMINAL) {
 		    dprintf("F: 0x%08x bytes at 0x%08x\n",
 			    list->next->start, list->start);
 		    return list;	/* It's free */
diff --git a/com32/lib/syslinux/zonelist.c b/com32/lib/syslinux/zonelist.c
index 7cd8364..a6de1d8 100644
--- a/com32/lib/syslinux/zonelist.c
+++ b/com32/lib/syslinux/zonelist.c
@@ -300,7 +300,7 @@ int syslinux_memmap_find(struct syslinux_memmap *mmap,
 	return 0;
 
     type = syslinux_memmap_type(mmap, *base, size);
-    if (type == SMT_FREE)
+    if (type == SMT_FREE || type == SMT_TERMINAL)
 	return 0;
 
     if (!relocate) {


More information about the Syslinux-commits mailing list