diff --git a/elks/arch/i86/drivers/block/bioshd.c b/elks/arch/i86/drivers/block/bioshd.c index 9f15c0e58..558ce2034 100644 --- a/elks/arch/i86/drivers/block/bioshd.c +++ b/elks/arch/i86/drivers/block/bioshd.c @@ -560,25 +560,25 @@ static int BFPROC do_readwrite(struct drive_infot *drivep, sector_t start, char drive, start, this_pass); #pragma GCC diagnostic ignored "-Wshift-count-overflow" - usedmaseg = seg >> 16; /* will be nonzero only if XMS configured and XMS buffer */ - if (!usedmaseg) { - /* check for 64k I/O overlap */ - physaddr = (seg << 4) + (unsigned int)buf; - end = this_pass * drivep->sector_size - 1; - usedmaseg = (physaddr + end < physaddr); - debug_blk("bioshd: %p:%p = %p count %d wrap %d\n", - (unsigned int)seg, buf, physaddr, this_pass, usedmaseg); - } - if (usedmaseg) { - segment = DMASEG; /* if xms buffer use DMASEG*/ - offset = 0; - if (cmd == WRITE) /* copy xms buffer down before write*/ - xms_fmemcpyw(0, DMASEG, buf, seg, this_pass*(drivep->sector_size >> 1)); - //set_cache_invalid(); /* don't invalidate cache - not shared */ - } else { - segment = (seg_t)seg; - offset = (unsigned) buf; - } + usedmaseg = seg >> 16; /* will be nonzero only if XMS configured and XMS buffer */ + if (!usedmaseg) { + /* check for 64k I/O overlap */ + physaddr = (seg << 4) + (unsigned int)buf; + end = this_pass * drivep->sector_size - 1; + usedmaseg = (physaddr + end < physaddr); + debug_blk("bioshd: %p:%p = %p count %d wrap %d\n", + (unsigned int)seg, buf, physaddr, this_pass, usedmaseg); + } + if (usedmaseg) { + segment = DMASEG; /* if xms buffer use DMASEG*/ + offset = 0; + if (cmd == WRITE) /* copy xms buffer down before write*/ + xms_fmemcpyw(0, DMASEG, buf, seg, this_pass*(drivep->sector_size >> 1)); + //set_cache_invalid(); /* don't invalidate cache - not shared */ + } else { + segment = (seg_t)seg; + offset = (unsigned) buf; + } errs = MAX_ERRS; /* BIOS disk reads should be retried at least five times */ do { debug_cache("%s%s%d CHS %d/%d/%d count %d\n", @@ -598,6 +598,9 @@ static int BFPROC do_readwrite(struct drive_infot *drivep, sector_t start, char } while (error && --errs); /* On error, retry up to MAX_ERRS times */ last_drive = drivep; + if (cmd == WRITE && drivep == cache_drive) + set_cache_invalid(); /* cache not updated on write so invalidate */ + if (error) return 0; /* error message in blk.h */ if (usedmaseg) { @@ -605,8 +608,6 @@ static int BFPROC do_readwrite(struct drive_infot *drivep, sector_t start, char xms_fmemcpyw(buf, seg, 0, DMASEG, this_pass*(drivep->sector_size >> 1)); //set_cache_invalid(); /* don't invalidate cache - not shared */ } - if (cmd == WRITE && drivep == cache_drive) - set_cache_invalid(); /* cache isn't updated on writes */ return this_pass; } @@ -689,8 +690,8 @@ static int BFPROC do_cache_read(struct drive_infot *drivep, sector_t start, char do_readtrack(drivep, start); /* read whole track*/ if (cache_valid(drivep, start, buf, seg)) /* try cache again*/ return 1; + //set_cache_invalid(); /* old code invalidated cache on failure */ } - set_cache_invalid(); return 0; } #endif diff --git a/elks/include/linuxmt/config.h b/elks/include/linuxmt/config.h index 085c5574e..dbbe6fa23 100644 --- a/elks/include/linuxmt/config.h +++ b/elks/include/linuxmt/config.h @@ -115,7 +115,7 @@ * outside its track cache; thus the complicated defines below. */ -#if defined(CONFIG_BLK_DEV_BFD) || defined(CONFIG_BLK_DEV_BHD) +#if defined(CONFIG_BLK_DEV_BFD) || defined(CONFIG_BLK_DEV_BHD) /* BIOS driver */ #define DMASEGSZ 0x0400 /* BLOCK_SIZE (1024) for external XMS/DMA buffer */ #else #define DMASEGSZ 0 /* no external XMS/DMA buffer */ @@ -123,9 +123,13 @@ #if defined(CONFIG_BLK_DEV_BFD) || defined(CONFIG_BLK_DEV_BHD) || defined(CONFIG_BLK_FD) #ifdef CONFIG_TRACK_CACHE /* floppy track buffer in low mem */ -#define TRACKSEGSZ 0x2400 /* SECTOR_SIZE * 18 (9216) */ +# define TRACKSEGSZ 0x2400 /* SECTOR_SIZE * 18 (9216) */ #else -#define TRACKSEGSZ 0x0400 /* BLOCK_SIZE (1024) */ +# ifdef CONFIG_BLK_FD +# define TRACKSEGSZ 0x0400 /* DF driver requires DMASEG internal to TRACKSEG */ +# else +# define TRACKSEGSZ 0 /* no TRACKSEG buffer */ +# endif #endif #define TRACKSEG (DMASEG+(DMASEGSZ>>4)) #define DMASEGEND (DMASEG+(DMASEGSZ>>4)+(TRACKSEGSZ>>4)) diff --git a/emu86.sh b/emu86.sh index 1baf26d1a..9c89c9970 100755 --- a/emu86.sh +++ b/emu86.sh @@ -21,7 +21,7 @@ exec emu86 -w 0xe0000 -f image/rom-8088.bin -w 0x80000 -f image/romfs-8088.bin $ # For ELKS Full ROM Configuration: # ELKS must be configured minimally with 'cp emu86-rom-full.config .config' # This adds MINIX/FAT filesytems with BIOS driver -#exec emu86 -w 0xe0000 -f rom-8088.bin -w 0x80000 -f image/romfs.bin -I image/fd1440.img ${1+"$@"} +#exec emu86 -w 0xe0000 -f image/rom-8088.bin -w 0x80000 -f image/romfs-8088.bin -I image/fd1440.img ${1+"$@"} # For ELKS disk image Configuration: # ELKS must be configured with 'cp emu86-disk.config .config'