Early August work on LBAcache & bugs
2026-08-09
Most of the work this week was on converting Eric Auer's LBAcache to provide and use an Alternate Multiplex Interrupt Specification (AMIS) multiplexer. (The use is in uncache, the transient part that works with previously installed instances rather than installing a new one.) The advantages are as follows:
Cooperates with other TSRs by providing an IBM Interrupt Sharing Protocol (IISP) header, and an interrupt list for the AMIS interface.
Decouples the hardcoded variable and entry layout required for prior versions.
Allows detecting resident instances without the error-prone memory scan.
Using the advanced deinstallation method the uninstaller can take advantage of other IISP headers and AMIS interrupt lists.
Multiple resident instances can now uninstall cleanly using a single STOP command.
The disadvantages are:
Need to hook interrupt 2Dh.
Several paragraphs of memory spent for the multiplexer-specific data structures and code handlers. (Due to the optimisations of the resident part, the updated LBAcache including the multiplexer still uses less memory (table @ 1050h) than Eric's last version (table @ 117Ch).)
I found that testing LBAcache works best with buffers=1 in ldos.ini, or by adding append buffers=1 to the kernel command line. That way, DOS cannot buffer as much as it would usually, hence more reads go to LBAcache's handler.
patchini
The patldos.asm assembly language program's matching of progress type keywords was severely broken. The changeset message states:
patldos.asm: fix match of PRO mode keywords
Selecting "app" would indicate an error stating that
"pp" was an invalid progress mode. The cause of this
error was the stray mov dx,si (si is CHG after the call to
comparecaps).
Next, the description would be matched unintentionally.
This was due to not incrementing past it for the first
.loopinnerpro iteration. Solved by moving inc di twice to
that label.
Subsequent mode keywords wouldn't be matched because the
code at .nextouterpro popped di once rather than twice.
Finally, .gotpro doesn't use the stacked di pointers any
longer so discard them off the stack.
lDOS kernel
-
Empty changeset
to rebuild for the new patldos revision of patchini.
Bugtracker
wwwecm scripts
LBAcache
-
-
-
-
-
-
-
Move the table label into an
[absolute $] section, so its alignment need not be emitted into the binary. Identicalised.
-
-
-
-
-
-
-
-
-
-
More optimisations, including to call old int 13h without a retn near return eating a stack slot.
-
Use IISP header for int13new. Drop the magic signature used to find resident instances in the memory scan. This makes the current uncache component incompatible with resident instances of this revision.
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Add the multiplexer detection loop to uncache. Uninstall is broken. Control variables are accessed using the hardcoded layout as yet. The stand-alone uncache.com build doesn't assemble yet.
-
Convert the infolists to an expanded format, which controls formatting in more detail and makes use of the ctrlX variables and interrupt list as returned by the resident multiplexer.
Add INFO display of new i13 handler, old and new i2D handlers, and the multiplex number.
-
-
-
-
Use remaining ctrlX and intr pointers for uncache. The uncache.com stand-alone build assembles for the first time. Uninstalling is commented out and as the changeset message states, "ecm advanced deinstallation method is tbd".
-
-
-
-
-
Add int 2Dh functions to flush all drives or one drive. This is required to properly implement disabling and enabling the resident instance; enabling needs to flush so no stale data is used.
-
-
Add ONCE command to operate on the first detected instance only, rather than on all instances that can be detected.
ETA:
Move the hello message into space re-used for the cache table, to save on resident space. The multiplexer already contains some identifying strings.
Optimise resinst entrypoint to just a call flush, increment running variable, and run int 21h to execute TSR. Saves some resident space.
Close all process handles on successful installation before TSR using int 21h function 31h. Fixes the System File Table (SFT) leak if run with I/O redirection.
Add RUNNING_ equates and clean up uses of the running variable, introducing the states RUNNING_INIT (as before), RUNNING_ENABLED (as before), and the newly distinguished disabled states: RUNNING_DISA (disabled using DISA command), RUNNING_SHUTDOWN (resident instance shut itself down due to invalid sector addressed or fishyfishy handler entered), RUNNING_FREED (XMS handle has been freed and thus the instance must not be re-enabled without allocating an XMS block).
Fix MEMOIZE function to use the drive/unit number for hashing, rather than the LRU byte of the cache table entry.
-
Use all-ones cache table entries as uninitialised. This saves some code in the flush functions which can just init the affected entries using all-ones. The inverted mask of used sectors takes slightly more code. The unit number field is used the same as before. The most complex change is using 255 as a "not used" LRU code and move the "frozen" LRU code to 254.
Fix REMEMOIZE code to mask away the BINMASK from sector number in EAX, both to run the memo hash and to compare the resulting cache table entry to the requested sector.
In setup
use the preferamisnum variable to check for a free multiplex number. In command line processing, do not set amisnum variable, only preferamisnum. This is in preparation for the next changesets.
-
-
-
-
-
-
-
Add ctrl5 control data structure with the point query, point hit, memo query, and memo hit counters (each a dword). Inclusion in the resident instance is controlled by a define (default enabled), whereas the transient uncache always includes support for these. Adds the new MEMO command to list these counters. (Note that point query minus point hit always should equal memo query.)
-
Move telltabsize into setup.asm and inline it into the only caller. Saves a bunch of resident space and even some of the file size.
-
-
-
Fix bestalloc to treat
byte [teLRU] equal to 255 as an unused table entry.
-
-
-
-
-
Add TABLE command which uses the newly expanded ctrl2 structure to count some values on the cache table use.
-
ETA:
Highlights
Eric's bugs
The veritable bugs in the old revision of Eric's LBAcache, mostly copying the entries from above that list the fixes:
-
The memory scanning uninstaller didn't free all memory if multiple instances of LBAcache were installed. The multiplexer uninstaller naturally finds the downlink from one LBAcache instance to another and uses it to uninstall everything, regardless the order of the scan results.
The memory scanning didn't find an LBAcache instance in a certain UMB on dosemu2, due to the segment addresses that it chose to scan, specifically with the PSP at segment C1AAh.
-
-
Close all process handles on successful installation before TSR using int 21h function 31h. Fixes the System File Table (SFT) leak if run with I/O redirection.
Fix MEMOIZE function to use the drive/unit number for hashing, rather than the LRU byte of the cache table entry.
Fix REMEMOIZE code to mask away the BINMASK from sector number in EAX, both to run the memo hash and to compare the resulting cache table entry to the requested sector.
-
-
ecm's bugs
Bugs that I introduced and later fixed during my work on LBAcache:
Optimisations