aboutsummaryrefslogtreecommitdiffstats
path: root/com32/lib
diff options
context:
space:
mode:
authorMatt Fleming <matt.fleming@intel.com>2013-07-16 18:13:17 +0100
committerMatt Fleming <matt.fleming@intel.com>2013-07-17 18:29:16 +0100
commita1331f8d04dbeb06d6f6c4c1fc736a50b0c0299a (patch)
treec401a8e91f9299afcabcbf6d4169a8f8263f920d /com32/lib
parent8f470e7bfe75f6401f6c5432988c620b863ad274 (diff)
downloadsyslinux-a1331f8d04dbeb06d6f6c4c1fc736a50b0c0299a.tar.gz
syslinux-a1331f8d04dbeb06d6f6c4c1fc736a50b0c0299a.tar.xz
syslinux-a1331f8d04dbeb06d6f6c4c1fc736a50b0c0299a.zip
memscan: pass enum syslinux_memmap_types around
The memscan interface should be using SMT_* to describe the types of memory regions as SMT_* are platform agnostic values. This will allow us to be much more descriptive about the type of memory regions in future. Signed-off-by: Matt Fleming <matt.fleming@intel.com>
Diffstat (limited to 'com32/lib')
-rw-r--r--com32/lib/syslinux/memmap.c7
-rw-r--r--com32/lib/syslinux/memscan.c15
2 files changed, 12 insertions, 10 deletions
diff --git a/com32/lib/syslinux/memmap.c b/com32/lib/syslinux/memmap.c
index 12baa33a..563e91b0 100644
--- a/com32/lib/syslinux/memmap.c
+++ b/com32/lib/syslinux/memmap.c
@@ -40,12 +40,11 @@
#include <syslinux/memscan.h>
#include <syslinux/movebits.h>
-static int syslinux_memory_map_callback(void *map, addr_t start,
- addr_t len, bool valid)
+static int syslinux_memory_map_callback(void *map, addr_t start, addr_t len,
+ enum syslinux_memmap_types type)
{
struct syslinux_memmap **mmap = map;
- return syslinux_add_memmap(mmap, start, len,
- valid ? SMT_FREE : SMT_RESERVED);
+ return syslinux_add_memmap(mmap, start, len, type);
}
struct syslinux_memmap *syslinux_memory_map(void)
diff --git a/com32/lib/syslinux/memscan.c b/com32/lib/syslinux/memscan.c
index 0ff25d7f..2fa14a23 100644
--- a/com32/lib/syslinux/memscan.c
+++ b/com32/lib/syslinux/memscan.c
@@ -70,7 +70,7 @@ int bios_scan_memory(scan_memory_callback_t callback, void *data)
else
dosmem = 640 * 1024; /* Hope for the best... */
}
- rv = callback(data, bios_data, dosmem - bios_data, true);
+ rv = callback(data, bios_data, dosmem - bios_data, SMT_FREE);
if (rv)
return rv;
@@ -113,8 +113,10 @@ int bios_scan_memory(scan_memory_callback_t callback, void *data)
len = maxlen;
if (len) {
- rv = callback(data, (addr_t) start, (addr_t) len,
- e820buf->type == 1);
+ enum syslinux_memmap_types type;
+
+ type = e820buf->type == 1 ? SMT_FREE : SMT_RESERVED;
+ rv = callback(data, (addr_t) start, (addr_t) len, type);
if (rv)
return rv;
memfound = 1;
@@ -134,12 +136,13 @@ int bios_scan_memory(scan_memory_callback_t callback, void *data)
__intcall(0x15, &ireg, &oreg);
if (!(oreg.eflags.l & EFLAGS_CF) && oreg.ecx.w[0]) {
- rv = callback(data, (addr_t) 1 << 20, oreg.ecx.w[0] << 10, true);
+ rv = callback(data, (addr_t) 1 << 20, oreg.ecx.w[0] << 10, SMT_FREE);
if (rv)
return rv;
if (oreg.edx.w[0]) {
- rv = callback(data, (addr_t) 16 << 20, oreg.edx.w[0] << 16, true);
+ rv = callback(data, (addr_t) 16 << 20,
+ oreg.edx.w[0] << 16, SMT_FREE);
if (rv)
return rv;
}
@@ -150,7 +153,7 @@ int bios_scan_memory(scan_memory_callback_t callback, void *data)
/* Finally try INT 15h AH=88h */
ireg.eax.w[0] = 0x8800;
if (!(oreg.eflags.l & EFLAGS_CF) && oreg.eax.w[0]) {
- rv = callback(data, (addr_t) 1 << 20, oreg.ecx.w[0] << 10, true);
+ rv = callback(data, (addr_t) 1 << 20, oreg.ecx.w[0] << 10, SMT_FREE);
if (rv)
return rv;
}