Skip to contentSkip to conversation

freezes when not emulating CPU (was: MIDI input patch)

DISCUSSION [email protected] 2 participants 2 messages Sep 9, 2009 – Sep 11, 2009

lore
Share & tools
lore
#0 lore raw

Hi all,

Stas Sergeev has once more offered his help offlist, and he's again done a great job. It turned out that my problems were FPU related. Stas worked out the patch below to fix them. The patch has been tested without problems in every day use on two machines so far, on a Pentium III ThinkPad and in a virtual Linux box in VMware on a Mac.

And here is the patch. I hope it's good for application to the trunk.

include/memory.h +4 -0
Index: src/include/memory.h
===================================================================
@@ -118,6 +118,10 @@
 #define INT70_OFF	0x63f0
 #define INT70_ADD	((INT70_SEG << 4) + INT70_OFF)
 
+#define INT75_SEG	ROMBIOSSEG
+#define INT75_OFF	0x7f00
+#define INT75_ADD	((INT75_SEG << 4) + INT75_OFF)
+
 #define INT1E_SEG	ROMBIOSSEG
 #define INT1E_OFF	0x6fc7
 #define INT41_SEG	ROMBIOSSEG
base/bios/setup.c +2 -5
Index: src/base/bios/setup.c
===================================================================
@@ -127,16 +127,13 @@
   SETIVEC(0x1e, INT1E_SEG, INT1E_OFF);
   SETIVEC(0x41, INT41_SEG, INT41_OFF);
   SETIVEC(0x46, INT46_SEG, INT46_OFF);
-
-  /* This is an int e7 used for FCB opens */
-  SETIVEC(0xe7, INTE7_SEG, INTE7_OFF);
-  /* End of int 0xe7 for FCB opens */
-
+  SETIVEC(0x75, INT75_SEG, INT75_OFF);
 #ifdef IPX
   /* IPX. Dummy but should not crash */
   if (config.ipxsup)
     SETIVEC(0x7a, BIOSSEG, INT_OFF(0x7a));
 #endif
+  SETIVEC(0xe7, INTE7_SEG, INTE7_OFF);
 
   /* Install new handler for video-interrupt into bios_f000_int10ptr,
    * for video initialization at f800:4200
base/bios/bios.S +12 -1
Index: src/base/bios/bios.S
===================================================================
@@ -947,7 +947,18 @@
 	iret				/* return to interrupted code	*/
 	.globl  CISH(INT08_dummy_end)
 CISH(INT08_dummy_end):
-        
+
+/* ----------------------------------------------------------------- */   
+	.org	((INT75_SEG-BIOSSEG) << 4)+INT75_OFF
+/* ======================= Addr = F800:7F00 (FFF00) */
+	xorb %al, %al
+	outb %al, $0xf0
+	movb $0x20, %al
+	outb %al, $0xa0
+	outb %al, $0x20
+	int $2		/* bochs does this */
+	iret
+
 /* COMPAS FFEF3		vector table for INT08-INT1F */
 /* COMPAS FFF23		vector table for INT70-INT77 */
 /* COMPAS FFF33-FFF53	reserved */
base/dev/sb16/dspio.c +6 -6
Index: src/base/dev/sb16/dspio.c
===================================================================
@@ -288,7 +288,6 @@
 {
     int dma_cnt, fifo_cnt;
     unsigned long long time_dst;
-    double period;
     Bit16u buf;
 
     dma_cnt = fifo_cnt = 0;
@@ -298,7 +297,6 @@
 	state->dma.stereo = sb_dma_samp_stereo();
 	state->dma.rate = sb_get_dma_sampling_rate();
     }
-    period = pcm_samp_period(state->dma.rate, state->dma.stereo + 1);
 
     while (state->output_running && (state->output_time_cur <= time_dst ||
 				     fifo_cnt % (state->dma.stereo + 1))) {
@@ -321,7 +319,8 @@
 						     samp_signed),
 				      state->dma_strm);
 	    }
-	    state->output_time_cur += period;
+	    state->output_time_cur += pcm_samp_period(state->dma.rate,
+		    state->dma.stereo + 1);
 	    fifo_cnt++;
 	} else {
 	    if (!sb_dma_active()) {
@@ -359,7 +358,8 @@
 	    dspio_run_dma(&state->dma);
 	    dma_cnt++;
 	}
-	state->input_time_cur += period;
+	state->input_time_cur += pcm_samp_period(state->dma.rate,
+		state->dma.stereo + 1);
 	fifo_cnt++;
     }
 
@@ -368,9 +368,9 @@
 	    dspio_fill_output(state);
 
     if (fifo_cnt || dma_cnt)
-	S_printf("SB: Processed %i FIFO, %i DMA, or=%i dr=%i time=%lli period=%f\n",
+	S_printf("SB: Processed %i FIFO, %i DMA, or=%i dr=%i time=%lli\n",
 	     fifo_cnt, dma_cnt, state->output_running, state->dma.running,
-	     time_dst, period);
+	     time_dst);
 }
 
 static void dspio_process_midi(void)
arch/linux/async/sigsegv.c +2 -1
Index: src/arch/linux/async/sigsegv.c
===================================================================
@@ -110,6 +110,7 @@
 		 return 0;
 
       case 0x10: /* coprocessor error */
+		 print_exception_info(scp);
 		 pic_request(PIC_IRQ13); /* this is the 386 way of signalling this */
 		 return 0;
 
@@ -252,7 +253,7 @@
 
     int retcode;
     if (_trapno == 0x10) {
-      g_printf("coprocessor exception, calling IRQ13\n");
+      print_exception_info(scp);
       pic_request(PIC_IRQ13);
       dpmi_return(scp);
       return -1;
emu-i386/cpu.c +65 -1

82 lines not on this page · raw message

______________________________________________________
GRATIS für alle WEB.DE-Nutzer: Die maxdome Movie-FLAT! Jetzt freischalten unter http://movieflat.web.de

--
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#1 lore raw
Quoted 3 lines · On Wed, Sep 9, 2009 at 3:17 PM, <[email protected]> wrote:

Stas Sergeev has once more offered his help offlist, and he's again done a great job.  It turned out that my problems were FPU related.  Stas worked out the patch below to fix them.  The patch has been tested without problems in every day use on two machines so far, on a Pentium III ThinkPad and in a virtual Linux box in VMware on a Mac.

And here is the patch.  I hope it's good for application to the trunk.

I applied the patch in SVN (1946,1947) with some small modifications (move the int75 handler position in the BIOS, and disabled the part that prints exception info for the non-fatal scenario that an FPU exception happens -- I guess that was just meant for debugging).

Thanks (to Stas also),
Bart
--
To unsubscribe from this list: send the line "unsubscribe linux-msdos" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html