From 8db46073f936df31dde53228eeb79a0232d45df6 Mon Sep 17 00:00:00 2001 From: Bart Oldeman Date: Sun, 26 Oct 2003 13:07:49 +0000 Subject: [PATCH] From: Eric Luttmann 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 the used. It is recommended that all the device drivers in the file return the same address. This fixes a load problem with DUSE. git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@721 6ac86273-5f31-0410-b378-82cca8765d1b --- kernel/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/kernel/main.c b/kernel/main.c index 887bc21..c2c2e49 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -535,8 +535,17 @@ BOOL init_device(struct dhdr FAR * dhp, char *cmdLine, COUNT mode, if (rq.r_endaddr == (BYTE FAR *) dhp) return TRUE; - KernelAllocPara(FP_SEG(rq.r_endaddr) + (FP_OFF(rq.r_endaddr) + 15)/16 - - FP_SEG(dhp), 'D', name, mode); + /* 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 */ + /* the used. It is recommended that all the device drivers in */ + /* the file return the same address */ + + if (FP_OFF(dhp->dh_next) == 0xffff) + { + KernelAllocPara(FP_SEG(rq.r_endaddr) + (FP_OFF(rq.r_endaddr) + 15)/16 + - FP_SEG(dhp), 'D', name, mode); + } } if (!(dhp->dh_attr & ATTR_CHAR) && (rq.r_nunits != 0))