[Prev][Next][Index][Thread]

Re: serial GDB and UVM / sproc



At Fri, 12 Apr 2002 23:10:15 +0900,
k-abe wrote:
> 
> > hehehe
> > 
> > Yup, I ran into the same thing and posted about it a while ago. My
> > solution was to just keep running vmware 2.0.4, which is annoying. If
> > anyone knows a fix for this, I'd be mighty appreciative.
> 
> I figured out the problem and I'm preparing for the fix.  
> Hopefully I'll post it within few days.

Please try this unofficial patch.  I tested on Linux-based VMware3.0
and 3.1 and seems it works.  But I haven't tested on a real machine so
I'm not sure whether this patch is correct or not.

Maybe line numbers on this patch differs from the snapshot but it must
be okay.

Kota Abe


Index: kern/x86/gdb_trap.c
===================================================================
RCS file: /n/fast/usr/lsrc/flux/CVS/oskit/kern/x86/gdb_trap.c,v
retrieving revision 1.14
diff -u -r1.14 gdb_trap.c
--- kern/x86/gdb_trap.c	2001/03/20 17:57:56	1.14
+++ kern/x86/gdb_trap.c	2002/04/15 05:25:00
@@ -115,8 +115,17 @@
 		r.ss = get_ss();
 	}
 
+	/* Disable furthur serial line interrupts.  Serial line
+	   conversation with GDB in gdb_signal() may generate another
+	   interrupt which looks like another SIGINT from GDB.  Avoid
+	   this.  */
+	gdb_cons_disable_receive_interrupt();
+
 	/* Call the appropriate GDB stub to do its thing.  */
 	gdb_signal(&signo, &r);
+
+	/* Enable serial line interrupts again.  */
+	gdb_cons_enable_receive_interrupt();
 
 	/* Stuff GDB's modified state into our trap_state.  */
 	ts->gs = r.gs;
Index: kern/x86/pc/com_cons.c
===================================================================
RCS file: /n/fast/usr/lsrc/flux/CVS/oskit/kern/x86/pc/com_cons.c,v
retrieving revision 1.22
diff -u -r1.22 com_cons.c
--- kern/x86/pc/com_cons.c	2001/02/03 05:33:44	1.22
+++ kern/x86/pc/com_cons.c	2002/04/15 05:25:00
@@ -16,8 +16,8 @@
 #include <oskit/x86/pc/com_cons.h>
 #include <oskit/c/string.h>
 
-static int ser_io_base[4];
-static struct termios ser_termios[4];
+static int ser_io_base[5];
+static struct termios ser_termios[5];
 
 int com_cons_trygetchar(int port)
 {
@@ -161,7 +161,15 @@
 	assert(port >= 1 && port <= 4);
 	assert(ser_io_base[port] != 0);
 
-	outb(ser_io_base[port] + 1, 0x01);	/* interrupt on received data */
+	outb(ser_io_base[port] + 1, 0x01);	/* enable interrupt on received data */
+}
+
+void com_cons_disable_receive_interrupt(int port)
+{
+	assert(port >= 1 && port <= 4);
+	assert(ser_io_base[port] != 0);
+
+	outb(ser_io_base[port] + 1, 0x0);	/* disable interrupt on received data */
 }
 
 
Index: kern/x86/pc/gdb_pc_com.c
===================================================================
RCS file: /n/fast/usr/lsrc/flux/CVS/oskit/kern/x86/pc/gdb_pc_com.c,v
retrieving revision 1.20
diff -u -r1.20 gdb_pc_com.c
--- kern/x86/pc/gdb_pc_com.c	2000/10/13 21:52:27	1.20
+++ kern/x86/pc/gdb_pc_com.c	2002/04/15 05:25:00
@@ -89,4 +89,13 @@
 #endif
 }
 
+void gdb_cons_enable_receive_interrupt()
+{
+	com_cons_enable_receive_interrupt(gdb_com_port);
+}
+
+void gdb_cons_disable_receive_interrupt()
+{
+	com_cons_disable_receive_interrupt(gdb_com_port);
+}
 
Index: oskit/x86/gdb.h
===================================================================
RCS file: /n/fast/usr/lsrc/flux/CVS/oskit/oskit/x86/gdb.h,v
retrieving revision 1.10
diff -u -r1.10 gdb.h
--- oskit/x86/gdb.h	2001/03/20 17:57:57	1.10
+++ oskit/x86/gdb.h	2002/04/15 05:25:00
@@ -80,4 +80,10 @@
  */
 void gdb_pc_com_init(int com_port, struct termios *com_params);
 
+/*
+ * Enable/Disable receiving serial line interrupts
+ */
+void gdb_cons_enable_receive_interrupt(void);
+void gdb_cons_disable_receive_interrupt(void);
+
 #endif /* _OSKIT_X86_GDB_H_ */
Index: oskit/x86/pc/com_cons.h
===================================================================
RCS file: /n/fast/usr/lsrc/flux/CVS/oskit/oskit/x86/pc/com_cons.h,v
retrieving revision 1.11
diff -u -r1.11 com_cons.h
--- oskit/x86/pc/com_cons.h	1998/12/07 07:10:23	1.11
+++ oskit/x86/pc/com_cons.h	2002/04/15 05:25:00
@@ -41,6 +41,7 @@
  * when the user presses CTRL-C from the remote debugger.
  */
 void com_cons_enable_receive_interrupt(int port);
+void com_cons_disable_receive_interrupt(int port);
 
 
 /*

References: