summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-12-22 12:42:20 -0800
committerH. Peter Anvin <hpa@zytor.com>2009-12-22 12:42:20 -0800
commitdeaba0fefcfa67b4bf85892cf315458613c130b7 (patch)
tree829462b36a8f799ef987514ca65b494d571f7ffc
parentd9e119a079c8864935b731b8b28568388cd5097b (diff)
downloadsyslinux-deaba0fefcfa67b4bf85892cf315458613c130b7.tar.gz
core: clean up the call to disk_init()syslinux-4.00-pre8
Move direct references to registers up as far as possible to make the code easier to read. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/fs.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/core/fs.c b/core/fs.c
index fc93685f..81bda515 100644
--- a/core/fs.c
+++ b/core/fs.c
@@ -166,7 +166,11 @@ void close_file(com32sys_t *regs)
*/
void fs_init(com32sys_t *regs)
{
- sector_t part_offset = regs->ecx.l | ((sector_t)regs->ebx.l << 32);
+ uint8_t disk_devno = regs->edx.b[0];
+ uint8_t disk_cdrom = regs->edx.b[1];
+ sector_t disk_offset = regs->ecx.l | ((sector_t)regs->ebx.l << 32);
+ uint16_t disk_heads = regs->esi.w[0];
+ uint16_t disk_sectors = regs->edi.w[0];
int blk_shift = -1;
struct device *dev = NULL;
/* ops is a ptr list for several fs_ops */
@@ -181,13 +185,12 @@ void fs_init(com32sys_t *regs)
* with FS_DEV filesystems...
*/
if (fs.fs_ops->fs_flags & FS_NODEV) {
- fs.fs_dev = NULL;
+ fs.fs_dev = NULL;
} else {
- if (!dev)
- dev = device_init(regs->edx.b[0], regs->edx.b[1],
- part_offset,
- regs->esi.w[0], regs->edi.w[0]);
- fs.fs_dev = dev;
+ if (!dev)
+ dev = device_init(disk_devno, disk_cdrom, disk_offset,
+ disk_heads, disk_sectors);
+ fs.fs_dev = dev;
}
/* invoke the fs-specific init code */
blk_shift = fs.fs_ops->fs_init(&fs);