summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJustus Winter <4winter@informatik.uni-hamburg.de>2014-08-21 16:51:54 +0200
committerSamuel Thibault <samuel.thibault@ens-lyon.org>2014-08-22 01:28:58 +0200
commited650a41c57d824f6503f266f21093d3ee18d21d (patch)
tree3bb3214616e15d7f2ed34804c6b526e07a4181a1
parenta32b7409276fceedc25962d013afb471e9d4e164 (diff)
Support invoking the debugger over the serial console
* i386/i386at/com.c (comintr): Invoke the debugger if ctrl-alt-d is pressed. * i386/i386at/com.h (kdb_kintr): Add declaration.
-rw-r--r--i386/i386at/com.c27
-rw-r--r--i386/i386at/com.h4
2 files changed, 30 insertions, 1 deletions
diff --git a/i386/i386at/com.c b/i386/i386at/com.c
index 5e65ad8..619e1af 100644
--- a/i386/i386at/com.c
+++ b/i386/i386at/com.c
@@ -518,10 +518,35 @@ comintr(int unit)
case RECi:
case CTIi: /* Character timeout indication */
if (tp->t_state&TS_ISOPEN) {
+ int escape = 0;
while ((line = inb(LINE_STAT(addr))) & iDR) {
c = inb(TXRX(addr));
- ttyinput(c, tp);
+
+ if (c == 0x1b) {
+ escape = 1;
+ continue;
+ }
+
+#if MACH_KDB
+ if (escape && c == 'D'-'@')
+ /* ctrl-alt-d pressed,
+ invoke debugger */
+ kdb_kintr();
+ else
+#endif /* MACH_KDB */
+ if (escape) {
+ ttyinput(0x1b, tp);
+ ttyinput(c, tp);
+ }
+ else
+ ttyinput(c, tp);
+
+ escape = 0;
}
+
+ if (escape)
+ /* just escape */
+ ttyinput(0x1b, tp);
} else
tt_open_wakeup(tp);
break;
diff --git a/i386/i386at/com.h b/i386/i386at/com.h
index 95baa45..779cdba 100644
--- a/i386/i386at/com.h
+++ b/i386/i386at/com.h
@@ -71,6 +71,10 @@ comsetstat(
int *data,
natural_t count);
+#if MACH_KDB
+extern void kdb_kintr(void);
+#endif /* MACH_KDB */
+
extern io_return_t comopen(dev_t dev, int flag, io_req_t ior);
extern void comclose(dev_t dev, int flag);
extern io_return_t comread(dev_t dev, io_req_t ior);