aboutsummaryrefslogtreecommitdiffstats
path: root/com32/gpllib/memory.c
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2012-06-08 14:07:37 +0100
committerMatt Fleming <matt.fleming@intel.com>2012-06-08 14:07:37 +0100
commitb1b44de1264c40f806f672012bac590cf87eca92 (patch)
tree158a0f5b18260e65e6a68a24afc667786a0e37f8 /com32/gpllib/memory.c
parente33c487c3930357a4f53455e019c72be0477ef98 (diff)
downloadsyslinux-b1b44de1264c40f806f672012bac590cf87eca92.tar.gz
syslinux-b1b44de1264c40f806f672012bac590cf87eca92.tar.xz
syslinux-b1b44de1264c40f806f672012bac590cf87eca92.zip
Delete all references to __com32.cs_bounce
The COM32 cs_bounce buffer is not usable with ELF modules, as we're trying to move to an environment where memory is dynamically allocated. All users of __com32.cs_bounce have been converted to using lmalloc() to allocate low memory. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/gpllib/memory.c')
-rw-r--r--com32/gpllib/memory.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/com32/gpllib/memory.c b/com32/gpllib/memory.c
index 28a95ff4..06c746da 100644
--- a/com32/gpllib/memory.c
+++ b/com32/gpllib/memory.c
@@ -87,15 +87,20 @@ void detect_memory_e820(struct e820entry *desc, int size_map, int *size_found)
{
int count = 0;
static struct e820_ext_entry buf; /* static so it is zeroed */
+ void *bounce;
com32sys_t ireg, oreg;
memset(&ireg, 0, sizeof ireg);
+ bounce = lmalloc(sizeof buf);
+ if (!bounce)
+ goto out;
+
ireg.eax.w[0] = 0xe820;
ireg.edx.l = SMAP;
ireg.ecx.l = sizeof(struct e820_ext_entry);
- ireg.edi.w[0] = OFFS(__com32.cs_bounce);
- ireg.es = SEG(__com32.cs_bounce);
+ ireg.edi.w[0] = OFFS(bounce);
+ ireg.es = SEG(bounce);
/*
* Set this here so that if the BIOS doesn't change this field
@@ -105,7 +110,7 @@ void detect_memory_e820(struct e820entry *desc, int size_map, int *size_found)
buf.ext_flags = 1;
do {
- memcpy(__com32.cs_bounce, &buf, sizeof buf);
+ memcpy(bounce, &buf, sizeof buf);
/* Important: %edx and %esi are clobbered by some BIOSes,
so they must be either used for the error output
@@ -126,7 +131,7 @@ void detect_memory_e820(struct e820entry *desc, int size_map, int *size_found)
if (oreg.eflags.l & EFLAGS_CF || oreg.ecx.l < 20)
break;
- memcpy(&buf, __com32.cs_bounce, sizeof buf);
+ memcpy(&buf, bounce, sizeof buf);
/*
* ACPI 3.0 added the extended flags support. If bit 0
@@ -143,6 +148,8 @@ void detect_memory_e820(struct e820entry *desc, int size_map, int *size_found)
ireg.ebx.l = oreg.ebx.l;
} while (ireg.ebx.l && count < size_map);
+out:
+ lfree(bounce);
*size_found = count;
}