[hatari-devel] Fseek bug with 64 bit OS (64 bit longs)

Eero Tamminen eerot at users.berlios.de
Sun Nov 22 10:43:10 CET 2009


Hi,

On Sunday 22 November 2009, Uwe Seimet wrote:
> there is a bug in the implementation of the Fseek() GEMDOS call, at
> least on 64 bit platforms, which causes the Pure debugger to fail with
> reporting "read error" when loading a binary to debug.
>
> The seek offset must be interpreted as a signed 32 bit value. On a 64 bit
> OS a signed 64 bit value is used, which results in a wrong file position
> calculation for negative offsets.

The gemdos emulation is based on old Winston code (Windows ST emulator),
it was quite bad in this respect.

...
> Most likely the final fix must be different in order to also work on 32
> bit machines, but I couldn't find any dedicated 32 bit data types in the
> Hatari sources for a generic solution.

Fixed data sizes are mandatory for an emulator.  We use the one SDL provides 
for this (Uint32, Sint32 etc).

Does the (untested) attached patch work for you?


	- Eero
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fseek.diff
Type: text/x-diff
Size: 1322 bytes
Desc: not available
URL: <https://lists.berlios.de/pipermail/hatari-devel/attachments/20091122/90de5fe1/attachment.diff>


More information about the hatari-devel mailing list