Hi,

I have recently been trying to migrate the data from my real Risc PC into RPCEmu. Whilst doing this I configured 2 IDE discs in the emulated Risc PC (with *configure idediscs 2). After doing this RPCEmu crashed during boot-up of the emulated RPC:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0xb7bee6c0 (LWP 10439)]
0xb7c8b20d in fseeko64 () from /lib/libc.so.6
(gdb) bt
#0  0xb7c8b20d in fseeko64 () from /lib/libc.so.6
#1  0x08052e43 in callbackide () at ide.c:695
#2  0x0805fb44 in execarm (cycs=20000) at ArmDynarec.c:1024
#3  0x08057a22 in execrpcemu () at rpcemu.c:244
#4  0x0806e8b5 in main (argc=Cannot access memory at address 0x0
) at rpc-linux.c:215
(gdb) up
#1  0x08052e43 in callbackide () at ide.c:695
(gdb) print ide.drive
$1 = 1
(gdb) print ide.hdfile[1]
$2 = (FILE *) 0x0

The crash was because it was trying to access the file ide.hdfile[1] which hadn't been initialised because of the if (config.cdromenabled) in resetide() (and because config.cdromenabled was 1).

I've fixed the error by making callbackide() flag an error in this case instead of trying to use a NULL file handle. Change at http://fe4e.ath.cx/hg/rpcemu-spoon-fjd-fixes/rev/67ee33160a3c . I'm not sure if I've implemented this correctly - I guessed how to raise an IDE error from the other code in this function. It does work though in that it prevents the crash.

An alternative that I tried was to remove the if (config.cdromenabled) check in resetide(). This allows existing images to be read as hd5.hdf but !HForm 2.56 fails to format :5. I don't think that this is the right fix though because only 1 hard disc can be connected to the motherboard IDE in a real Risc PC when a CD-ROM drive is attached to the motherboard IDE.

I originally found this crash on Mac OS X but reproduced it on Linux as well with the latest Spoon code from Mercurial.

Francis


_______________________________________________
Rpcemu mailing list
[email protected]
http://www.riscos.info/cgi-bin/mailman/listinfo/rpcemu

Reply via email to