aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-04-27 15:36:45 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-04-27 15:36:45 -0700
commit09ed0b6f311dfe9bf01e9ed025a77ce6bf2a3d8e (patch)
tree619162f347ecf74271cfb9cac315ef031f565265
parent642841bb1542c304e9da5eb98f4c18100b723cb8 (diff)
downloadsyslinux.git-09ed0b6f311dfe9bf01e9ed025a77ce6bf2a3d8e.tar.gz
syslinux.git-09ed0b6f311dfe9bf01e9ed025a77ce6bf2a3d8e.tar.xz
syslinux.git-09ed0b6f311dfe9bf01e9ed025a77ce6bf2a3d8e.zip
memscan: correctly handle the DOS memory fallback case
Actually (try to) handle the case of finding the DOS memory amount. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--com32/lib/syslinux/memscan.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/com32/lib/syslinux/memscan.c b/com32/lib/syslinux/memscan.c
index 782f6346..dadafd06 100644
--- a/com32/lib/syslinux/memscan.c
+++ b/com32/lib/syslinux/memscan.c
@@ -57,8 +57,9 @@ int syslinux_scan_memory(scan_memory_callback_t callback, void *data)
int memfound = 0;
int rv;
addr_t dosmem;
+ const addr_t bios_data = 0x510; /* Amount to reserve for BIOS data */
- /* Use INT 12h to get DOS memory above 0x504 */
+ /* Use INT 12h to get DOS memory */
__intcall(0x12, &__com32_zero_regs, &oreg);
dosmem = oreg.eax.w[0] << 10;
if (dosmem < 32*1024 || dosmem > 640*1024) {
@@ -67,10 +68,9 @@ int syslinux_scan_memory(scan_memory_callback_t callback, void *data)
if (ebda_seg >= 0x8000 && ebda_seg < 0xa000)
dosmem = ebda_seg << 4;
else
- dosmem = 640*1024; /* Hope for the best... */
+ dosmem = 640*1024; /* Hope for the best... */
}
- dosmem = (oreg.eax.w[0] << 10) - 0x510;
- rv = callback(data, 0x510, dosmem, true);
+ rv = callback(data, bios_data, dosmem-bios_data, true);
if (rv)
return rv;