[hatari-devel] GEMDOS emulation and host-side DTA caching |
[ Thread Index | Date Index | More lists.tuxfamily.org/hatari-devel Archives ]
Hi, seen here: <http://www.atari-forum.com/viewtopic.php?f=51&t=38406>. A user wanted to copy a complex directory tree from a GEMDOS emulated drive. The recursive Fsfirst/Fsnext required to do so exhausted Hatari's tiny [1] host-side DTA cache, therefore resulting in only a partial copy operation. A simplified test case is attached. It needs to be run from a GEMDOS drive C: with some files on it. Also the folder C:\TEST has to exist and it too needs to contain some files. Expected behavior is getting a file name from C:\, but the test program will output a file name from C:\TEST instead. I don't have a solution for this; I just wanted to bring this up to discussion. Ideas I came up with: - Simply increasing the cache size, like the user did. Only makes the issue less likely, but easy to implement. - Somehow cram all host-side state into the Atari-side DTA, more specifically its 'reserved' field. Probably not doable, also dangerous because the emulated program could corrupt the host-side state. - Instead of linearly incrementing the index of the host-side DTA cache entry, using a hash of the Atari-side address of the DTA as index into a (sufficiently large) array. Collisions can still occur, but if an application (like my test program or the Desktop) reuses DTAs, this makes sure that an unneeded cache entry is overwritten instead of a potentially still needed one. Regards Christian [1] <https://git.tuxfamily.org/hatari/hatari.git/tree/src/gemdos.c?id=v2.2.1#n103> -- Christian Zietz - CHZ-Soft - czietz@xxxxxxx WWW: https://www.chzsoft.de/ PGP/GnuPG-Key-ID: 0x52CB97F66DA025CA / 0x6DA025CA
#include <osbind.h> _DTA dta_main; _DTA dta_sub; int main(void) { int k; /* Find files on (GEMDOS) drive C: */ Fsetdta(&dta_main); Fsfirst("C:\\*.*", 0); /* Exhaust Hatari host-side DTA cache */ Fsetdta(&dta_sub); for (k=0; k<256; k++) { Fsfirst("C:\\TEST\\*.*", 0); } /* Should go back to C:\, but doesn't. */ Fsetdta(&dta_main); k = Fsnext(); if (k<0) { Cconws("Error\r\n"); } else { Cconws(((_DTA *)Fgetdta())->dta_name); Cconws("\r\n"); } return 0; }
Attachment:
hat_dta.tos
Description: Binary data
Mail converted by MHonArc 2.6.19+ | http://listengine.tuxfamily.org/ |