[syslinux:elflink] elflink: meminfo.c: change cs_bounce buf to lmalloc

syslinux-bot for Feng Tang feng.tang at intel.com
Thu Aug 12 21:03:35 PDT 2010


Commit-ID:  316e4ce6068bf53c3e5622f81f4de33443376f67
Gitweb:     http://syslinux.zytor.com/commit/316e4ce6068bf53c3e5622f81f4de33443376f67
Author:     Feng Tang <feng.tang at intel.com>
AuthorDate: Wed, 30 Jun 2010 14:33:13 +0800
Committer:  Feng Tang <feng.tang at intel.com>
CommitDate: Tue, 20 Jul 2010 11:10:04 +0800

elflink: meminfo.c: change cs_bounce buf to lmalloc



---
 com32/elflink/modules/meminfo.c |   15 +++++++++++----
 1 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/com32/elflink/modules/meminfo.c b/com32/elflink/modules/meminfo.c
index d5e3f38..db9718a 100644
--- a/com32/elflink/modules/meminfo.c
+++ b/com32/elflink/modules/meminfo.c
@@ -44,27 +44,32 @@ static void dump_e820(void)
     com32sys_t ireg, oreg;
     struct e820_data ed;
     uint32_t type;
+    void *low_ed;
+
+	low_ed = lmalloc(sizeof ed);
+	if (!low_ed)
+		return;
 
     memset(&ireg, 0, sizeof ireg);
 
     ireg.eax.w[0] = 0xe820;
     ireg.edx.l = 0x534d4150;
     ireg.ecx.l = sizeof(struct e820_data);
-    ireg.edi.w[0] = OFFS(__com32.cs_bounce);
-    ireg.es = SEG(__com32.cs_bounce);
+    ireg.edi.w[0] = OFFS(low_ed);
+    ireg.es = SEG(low_ed);
 
     memset(&ed, 0, sizeof ed);
     ed.extattr = 1;
 
     do {
-	memcpy(__com32.cs_bounce, &ed, sizeof ed);
+	memcpy(low_ed, &ed, sizeof ed);
 
 	__intcall(0x15, &ireg, &oreg);
 	if (oreg.eflags.l & EFLAGS_CF ||
 	    oreg.eax.l != 0x534d4150 || oreg.ecx.l < 20)
 	    break;
 
-	memcpy(&ed, __com32.cs_bounce, sizeof ed);
+	memcpy(&ed, low_ed, sizeof ed);
 
 	if (oreg.ecx.l >= 24) {
 	    /* ebx base length end type */
@@ -86,6 +91,8 @@ static void dump_e820(void)
 
 	ireg.ebx.l = oreg.ebx.l;
     } while (ireg.ebx.l);
+
+    free(low_ed);
 }
 
 static void dump_legacy(void)



More information about the Syslinux-commits mailing list