sarah-walker-pcem / pcem

PCem
http://pcem-emulator.co.uk
GNU General Public License v2.0
1.47k stars 204 forks source link

segfault in outb - snd_rawmidi_write() #251

Open fenugrec opened 4 months ago

fenugrec commented 4 months ago

Describe the bug Trying to run https://dosmid.sourceforge.net/ on a freedos image

To Reproduce

  1. configure machine as 486 with sb16 sound card
  2. try to play a midi file with dosmid.
  3. ( I wasn't able to reproduce this by just executing an OUT AL,DX with DX=0x330 in DEBUG )
  4. segfault

Expected behavior Some kind of playback, or at least not a crash

Screenshots

.....
Opening MIDI port hw:0,0,0
Failed to open MIDI
...
Thread 25 "Main Thread" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fff83fff6c0 (LWP 14352)]
0x00007ffff70d9bb4 in snd_rawmidi_write () from /usr/lib/libasound.so.2
(gdb) i s
#0  0x00007ffff70d9bb4 in snd_rawmidi_write () at /usr/lib/libasound.so.2
#1  0x0000555555ab9b02 in outb (port=0x330, val=0x0) at /usr/src/debug/pcem-git/pcem/src/io.c:128
#2  0x000055555586dbbe in opOUT_AL_DX (rmdat=<optimized out>) at /usr/src/debug/pcem-git/pcem/includes/private/cpu/x86_ops_io.h:127
#3  0x00007fffe7278509 in ??? ()
#4  0x0000000000005f02 in ??? ()
#5  0x0000555500000014 in ??? ()
#6  0x0000001000000000 in ??? ()
#7  0x00000000000000f1 in ??? ()
#8  0x0000000000001eb5 in ??? ()
#9  0x000000000000412e in ??? ()
#10 0x000000f200000004 in ??? ()
#11 0x0000000000000000 in ??? ()

Emulator configuration

Host machine

Additional context I'm not sure why it's trying to open and access a raw ALSA midi device, since its configured for sb16?