aboutsummaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorLiu Aleaxander <Aleaxander@gmail.com>2009-06-04 06:13:50 +0800
committerLiu Aleaxander <Aleaxander@gmail.com>2009-06-04 06:13:50 +0800
commite14fe0d2fac879eb01a0667ed0fde69813fd06b8 (patch)
treec7f0a1f015ba1c58d3e27e9b0a2b1a09b313be5f /core
parent922943ba67a767c61bcc839c3a762d9cabc39741 (diff)
downloadsyslinux-e14fe0d2fac879eb01a0667ed0fde69813fd06b8.tar.gz
syslinux-e14fe0d2fac879eb01a0667ed0fde69813fd06b8.tar.xz
syslinux-e14fe0d2fac879eb01a0667ed0fde69813fd06b8.zip
Core: use __lowmem for sector read buffer exchange inseatd of core_xfer_buf
Diffstat (limited to 'core')
-rw-r--r--core/disk.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/core/disk.c b/core/disk.c
index 71c51470..7d2c2664 100644
--- a/core/disk.c
+++ b/core/disk.c
@@ -6,15 +6,26 @@
void read_sectors(char *buf, sector_t sector_num, int sectors)
{
com32sys_t regs;
+ static __lowmem char low_buf[65536];
+ /* for safe, we use buf + (sectors << SECTOR_SHIFT) here */
+ int high_addr = (buf + (sectors << SECTOR_SHIFT)) > (char *)0x100000;
memset(&regs, 0, sizeof regs);
regs.eax.l = sector_num;
regs.ebp.l = sectors;
- regs.es = SEG(core_xfer_buf);
- regs.ebx.w[0] = OFFS(core_xfer_buf);
+
+ if (high_addr) {
+ regs.es = SEG(low_buf);
+ regs.ebx.w[0] = OFFS(low_buf);
+ } else {
+ regs.es = SEG(buf);
+ regs.ebx.w[0] = OFFS(buf);
+ }
+
call16(getlinsec, &regs, NULL);
- memcpy(buf, core_xfer_buf, sectors << SECTOR_SHIFT);
+ if (high_addr)
+ memcpy(buf, core_xfer_buf, sectors << SECTOR_SHIFT);
}