aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiu Aleaxander <Aleaxander@gmail.com>2009-06-03 13:50:48 +0800
committerLiu Aleaxander <Aleaxander@gmail.com>2009-06-03 13:50:48 +0800
commitf0b750340a1d2dac0953b185b3ef48d1dc358e76 (patch)
tree76cd131771c8ab14b496a5534eff64fb726e9ff7
parent7fc77159cc87c848e8c222951516731b433f9944 (diff)
downloadsyslinux-f0b750340a1d2dac0953b185b3ef48d1dc358e76.tar.gz
syslinux-f0b750340a1d2dac0953b185b3ef48d1dc358e76.tar.xz
syslinux-f0b750340a1d2dac0953b185b3ef48d1dc358e76.zip
Wrap the getlinsec function
Add a new function read_sectors, the only function will call getlinsec, so we can read sectors easily by calling read_sectors function
-rw-r--r--core/cache.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/core/cache.c b/core/cache.c
index dca85a7d..ebef5569 100644
--- a/core/cache.c
+++ b/core/cache.c
@@ -55,19 +55,27 @@ void cache_init(com32sys_t * regs)
}
-void getoneblk(char *buf, uint32_t block, int block_size)
+void read_sectors(char *buf, int sector_num, int sectors)
{
- int sec_per_block = block_size >> 9; /* 512==sector size */
- com32sys_t regs;
+ com32sys_t regs;
- memset(&regs, 0, sizeof(regs) );
+ 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);
+
+ call16(getlinsec, &regs, NULL);
+
+ memcpy(buf, core_xfer_buf, sectors << 9);
+}
- regs.eax.l = block * sec_per_block;
- regs.ebp.l = sec_per_block;
- regs.es = SEG(buf);
- regs.ebx.w[0] = OFFS(buf);
- call16(getlinsec, &regs, NULL);
+void getoneblk(char *buf, uint32_t block, int block_size)
+{
+ int sec_per_block = block_size >> 9; /* 512==sector size */
+
+ read_sectors(buf, block * sec_per_block, sec_per_block);
}