diff options
| author | H. Peter Anvin <hpa@zytor.com> | 2010-02-24 14:18:49 -0800 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2010-02-24 14:18:49 -0800 |
| commit | 8a4b35805fdc6651d288a3e1c2d98aa504cb9c05 (patch) | |
| tree | 37c4bdef99996ab681e03c7a3f407563a9ff35d7 /com32/lib/syslinux/memscan.c | |
| parent | 3ae1da98a68d2f719ce17766550f7e9682ba8ae7 (diff) | |
| download | syslinux-4.00-pre25.tar.gz | |
com32: replace hard-coded bounce buffer use in com32/libsyslinux-4.00-pre25
Replace hard-coded bounce buffer uses in com32/lib with lmalloc/lfree.
Signed-off-by: H. Peter Anvin <hpa@zytor.com>
Diffstat (limited to 'com32/lib/syslinux/memscan.c')
| -rw-r--r-- | com32/lib/syslinux/memscan.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/com32/lib/syslinux/memscan.c b/com32/lib/syslinux/memscan.c index 95580257..fc676cbf 100644 --- a/com32/lib/syslinux/memscan.c +++ b/com32/lib/syslinux/memscan.c @@ -51,7 +51,7 @@ int syslinux_scan_memory(scan_memory_callback_t callback, void *data) { static com32sys_t ireg; com32sys_t oreg; - struct e820_entry *e820buf = __com32.cs_bounce; + struct e820_entry *e820buf; uint64_t start, len, maxlen; int memfound = 0; int rv; @@ -74,13 +74,16 @@ int syslinux_scan_memory(scan_memory_callback_t callback, void *data) return rv; /* First try INT 15h AX=E820h */ + e820buf = lzalloc(sizeof *e820buf); + if (!e820buf) + return -1; + ireg.eax.l = 0xe820; ireg.edx.l = 0x534d4150; ireg.ebx.l = 0; ireg.ecx.l = sizeof(*e820buf); ireg.es = SEG(e820buf); ireg.edi.w[0] = OFFS(e820buf); - memset(e820buf, 0, sizeof *e820buf); do { __intcall(0x15, &ireg, &oreg); @@ -120,6 +123,8 @@ int syslinux_scan_memory(scan_memory_callback_t callback, void *data) ireg.ebx.l = oreg.ebx.l; } while (oreg.ebx.l); + lfree(e820buf); + if (memfound) return 0; |
