diff --git a/kernel/dsk.c b/kernel/dsk.c index e3c2989..977e671 100644 --- a/kernel/dsk.c +++ b/kernel/dsk.c @@ -237,8 +237,7 @@ STATIC WORD diskchange(ddt * pddt) { COUNT result; - /* if it's a hard drive, media never changes */ - if (hd(pddt->ddt_descflags)) + if (hd(pddt->ddt_descflags) && !(pddt->ddt_descflags & DF_CHANGELINE)) return M_NOT_CHANGED; if (play_dj(pddt) == M_CHANGED) @@ -983,6 +982,7 @@ STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer, } */ + buffer = adjust_far(buffer); for (; totaltodo != 0;) { /* avoid overflowing 64K DMA boundary */ @@ -1087,7 +1087,7 @@ STATIC int LBA_Transfer(ddt * pddt, UWORD mode, VOID FAR * buffer, LBA_address += count; totaltodo -= count; - buffer = add_far(buffer, count * 512); + buffer = adjust_far((char FAR *)buffer + count * 512); } return (error_code); diff --git a/kernel/fatfs.c b/kernel/fatfs.c index 0a22f28..c4e27bc 100644 --- a/kernel/fatfs.c +++ b/kernel/fatfs.c @@ -1629,7 +1629,7 @@ long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode) secsize = fnp->f_dpb->dpb_secsize; /* Adjust the far pointer from user space to supervisor space */ - buffer = adjust_far((VOID FAR *) buffer); + buffer = adjust_far(buffer); /* Do the data transfer. Use block transfer methods so that we */ /* can utilize memory management in future DOS-C versions. */ @@ -1806,7 +1806,7 @@ long rwblock(COUNT fd, VOID FAR * buffer, UCOUNT count, int mode) update_pointers: ret_cnt += xfr_cnt; to_xfer -= xfr_cnt; - buffer = add_far(buffer, xfr_cnt); + buffer = adjust_far((char FAR *)buffer + xfr_cnt); if (mode == XFR_WRITE) { if (fnp->f_offset > fnp->f_dir.dir_size) diff --git a/kernel/memmgr.c b/kernel/memmgr.c index c2486a0..adeffed 100644 --- a/kernel/memmgr.c +++ b/kernel/memmgr.c @@ -80,28 +80,6 @@ seg far2para(VOID FAR * p) return FP_SEG(p) + (FP_OFF(p) >> 4); } -/* - * Add a displacement to a far pointer and return the result normalized. - */ -void FAR * add_far(void FAR * fp, unsigned off) -{ - unsigned segment, offset; - - if (FP_SEG(fp) == 0xffff) - return ((char FAR *) fp) + off; - -#ifndef I86 - if (FP_SEG(fp) == 0) - return ((char FAR *) fp) + off; -#endif - - offset = off + FP_OFF(fp); - segment = FP_SEG(fp) + (offset >> 4); - if (offset < off) /* forward carry without using a long */ - segment += 0x1000; - return MK_FP(segment, offset & 0xf); -} - /* * Return a normalized far pointer */