From 51adbac8fd6c2fa4de6f7cf044197510babd6b38 Mon Sep 17 00:00:00 2001 From: Kenneth J Davis Date: Sat, 1 Jan 2005 18:07:03 +0000 Subject: [PATCH] do not fail on internal driver, corrects bug 1850 fix to work with test case git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/branches/UNSTABLE@1085 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/main.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/kernel/main.c b/kernel/main.c index ca2b4d2..579ace8 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -482,6 +482,14 @@ BOOL init_device(struct dhdr FAR * dhp, PCStr cmdLine, int mode, VFP *r_top) if (rq.r_endaddr == (BYTE FAR *) dhp) return TRUE; + /* Don't link in block device drivers which indicate no units */ + if (!(dhp->dh_attr & ATTR_CHAR) && !rq.r_nunits) + { + rq.r_endaddr = (BYTE FAR *) dhp; + return TRUE; + } + + /* Fix for multisegmented device drivers: */ /* If there are multiple device drivers in a single driver file, */ /* only the END ADDRESS returned by the last INIT call should be */ @@ -531,15 +539,11 @@ BOOL init_device(struct dhdr FAR * dhp, PCStr cmdLine, int mode, VFP *r_top) *r_top = rq.r_endaddr; } - if (!(dhp->dh_attr & ATTR_CHAR)) /* if block device (not character) */ + /* if block device (not character) and unit count is nonzero */ + if (!(dhp->dh_attr & ATTR_CHAR) && rq.r_nunits) { - if (rq.r_nunits) /* if unit count is nonzero */ - { - dhp->dh_name[0] = rq.r_nunits; - update_dcb(dhp); - } - else /* returned unit count of 0, indication of load failure */ - return TRUE; + dhp->dh_name[0] = rq.r_nunits; + update_dcb(dhp); } if (dhp->dh_attr & ATTR_CONIN) @@ -615,7 +619,7 @@ STATIC VOID InitSerialPorts(VOID) booted from HD */ -static int EmulatedDriveStatus(int drive,char statusOnly) +STATIC int EmulatedDriveStatus(int drive,char statusOnly) { iregs r; char buffer[0x13];