Adding Brian Reifsnyder Fix for Int 25/26

git-svn-id: https://svn.code.sf.net/p/freedos/svn/kernel/trunk@79 6ac86273-5f31-0410-b378-82cca8765d1b
This commit is contained in:
Jim Tabor 2000-10-30 00:21:15 +00:00
parent 0191c4bb2a
commit c602b6a7ed
3 changed files with 93 additions and 48 deletions

View File

@ -36,7 +36,14 @@ static BYTE *blockioRcsId = "$Id$";
#endif
/*
* 2000/9/04 Brian Reifsnyder
* Modified dskxfer() such that error codes are now returned.
* Functions that rely on dskxfer() have also been modified accordingly.
*
* $Log$
* Revision 1.5 2000/10/30 00:21:15 jimtabor
* Adding Brian Reifsnyder Fix for Int 25/26
*
* Revision 1.4 2000/05/25 20:56:21 jimtabor
* Fixed project history
*
@ -478,12 +485,14 @@ BOOL flush_buffers(REG COUNT dsk)
/* */
BOOL flush1(struct buffer FAR * bp)
{
REG WORD ok;
/* All lines with changes on 9/4/00 by BER marked below */
UWORD result; /* BER 9/4/00 */
if ((bp->b_flag & BFR_VALID) && (bp->b_flag & BFR_DIRTY))
{
ok = dskxfer(bp->b_unit, getblkno(bp),
(VOID FAR *) bp->b_buffer, 1, DSKWRITE);
result = dskxfer(bp->b_unit, getblkno(bp),
(VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
if (bp->b_flag & BFR_FAT)
{
int i = bp->b_copies;
@ -493,17 +502,18 @@ BOOL flush1(struct buffer FAR * bp)
while (--i > 0)
{
blkno += offset;
ok &= dskxfer(bp->b_unit, blkno,
(VOID FAR *) bp->b_buffer, 1, DSKWRITE);
result = dskxfer(bp->b_unit, blkno,
(VOID FAR *) bp->b_buffer, 1, DSKWRITE); /* BER 9/4/00 */
}
}
}
else
ok = TRUE;
result = TRUE; /* This negates any error code returned in result...BER */
bp->b_flag &= ~BFR_DIRTY; /* even if error, mark not dirty */
if (!ok) /* otherwise system has trouble */
if (!result) /* otherwise system has trouble */
bp->b_flag &= ~BFR_VALID; /* continuing. */
return (ok);
return (TRUE); /* Forced to TRUE...was like this before dskxfer() */
/* returned error codes...BER */
}
/* */
@ -536,13 +546,21 @@ BOOL flush(void)
sector is not already in the buffer ring */
BOOL fill(REG struct buffer FAR * bp, ULONG blkno, COUNT dsk)
{
REG WORD ok;
/* Changed 9/4/00 BER */
UWORD result;
ok = dskxfer(dsk, blkno, (VOID FAR *) bp->b_buffer, 1, DSKREAD);
result = dskxfer(dsk, blkno, (VOID FAR *) bp->b_buffer, 1, DSKREAD);
/* End of change */
bp->b_flag = BFR_VALID | BFR_DATA;
bp->b_unit = dsk;
setblkno(bp, blkno);
return (ok);
/* Changed 9/4/00 BER */
if(result==0) return(TRUE); /* Temporary code to convert the result to */
else return(FALSE); /* the old BOOL result...BER */
/* return (result); This is what should eventually be returned */
/* End of change */
}
/************************************************************************/
@ -553,7 +571,10 @@ BOOL fill(REG struct buffer FAR * bp, ULONG blkno, COUNT dsk)
/* */
/* Transfer one or more blocks to/from disk */
/* */
BOOL dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode)
/* Changed to UWORD 9/4/00 BER */
UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode)
/* End of change */
{
/* REG struct dpb *dpbp = &blk_devices[dsk]; */
@ -583,12 +604,18 @@ BOOL dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode
break;
else
{
/* Changed 9/4/00 BER */
return (IoReqHdr.r_status);
/* Skip the abort, retry, fail code...it needs fixed...BER */
/* End of change */
loop:
switch (block_error(&IoReqHdr, dpbp->dpb_unit, dpbp->dpb_device))
{
case ABORT:
case FAIL:
return FALSE;
return (IoReqHdr.r_status);
case RETRY:
continue;
@ -601,5 +628,8 @@ BOOL dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode
}
}
}
return TRUE;
/* *** Changed 9/4/00 BER */
return 0; /* Success! Return 0 for a successful operation. */
/* End of change */
}

View File

@ -36,6 +36,12 @@ BYTE *RcsId = "$Id$";
/*
* $Log$
* Revision 1.11 2000/10/30 00:21:15 jimtabor
* Adding Brian Reifsnyder Fix for Int 25/26
*
* 2000/09/04 Brian Reifsnyder
* Modified interrupts 0x25 & 0x26 to return more accurate error codes.
*
* Revision 1.10 2000/10/29 23:51:56 jimtabor
* Adding Share Support by Ron Cemer
*
@ -1820,13 +1826,15 @@ VOID int25_handler(struct int25regs FAR * r)
return;
}
if (!dskxfer(drv, blkno, buf, nblks, DSKREAD))
/* *** Changed 9/4/00 BER */
r->ax=dskxfer(drv, blkno, buf, nblks, DSKREAD);
if (r->ax > 0)
{
/* XXX: should tell the user exactly what the error was */
r->ax = 0x202;
r->flags |= FLG_CARRY;
--InDOS;
return;
}
/* End of change */
r->ax = 0;
r->flags &= ~FLG_CARRY;
@ -1863,13 +1871,15 @@ VOID int26_handler(struct int25regs FAR * r)
return;
}
if (!dskxfer(drv, blkno, buf, nblks, DSKWRITE))
/* *** Changed 9/4/00 BER */
r->ax=dskxfer(drv, blkno, buf, nblks, DSKWRITE);
if (r->ax > 0)
{
/* XXX: should tell the user exactly what the error was */
r->ax = 0x202;
r->flags |= FLG_CARRY;
--InDOS;
return;
}
/* End of change */
setinvld(drv);

View File

@ -34,6 +34,9 @@ static BYTE *Proto_hRcsId = "$Id$";
/*
* $Log$
* Revision 1.8 2000/10/30 00:21:15 jimtabor
* Adding Brian Reifsnyder Fix for Int 25/26
*
* Revision 1.7 2000/08/07 22:51:34 jimtabor
* Remove unused code
*
@ -167,7 +170,9 @@ BOOL flush_buffers(REG COUNT dsk);
BOOL flush1(struct buffer FAR * bp);
BOOL flush(void);
BOOL fill(REG struct buffer FAR * bp, ULONG blkno, COUNT dsk);
BOOL dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode);
/* *** Changed on 9/4/00 BER */
UWORD dskxfer(COUNT dsk, ULONG blkno, VOID FAR * buf, UWORD numblocks, COUNT mode);
/* *** End of change
/* chario.c */
VOID cso(COUNT c);