summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorps <ps@FreeBSD.org>2000-06-14 06:41:33 +0000
committerps <ps@FreeBSD.org>2000-06-14 06:41:33 +0000
commit27235775e10be39868b9f27f126f607c31596275 (patch)
treefa2b6bc115b5feed5b1ae66b9b01fe8ea30ce4fc /sys
parent9941e0786710b93c7b52eb1adf70c4c2ad6571e1 (diff)
downloadFreeBSD-src-27235775e10be39868b9f27f126f607c31596275.zip
FreeBSD-src-27235775e10be39868b9f27f126f607c31596275.tar.gz
Add option ALT_BREAK_TO_DEBUGGER.
Implement the Solaris way to break into DDB over a serial console instead of sending a break. Sending the character sequence CR ~ ^b will break the kernel into DDB (if DDB is enabled). Reviewed by: peter
Diffstat (limited to 'sys')
-rw-r--r--sys/conf/NOTES5
-rw-r--r--sys/conf/options1
-rw-r--r--sys/dev/sio/sio.c29
-rw-r--r--sys/i386/conf/NOTES5
-rw-r--r--sys/isa/sio.c29
5 files changed, 69 insertions, 0 deletions
diff --git a/sys/conf/NOTES b/sys/conf/NOTES
index 746dbae..305225d 100644
--- a/sys/conf/NOTES
+++ b/sys/conf/NOTES
@@ -1242,6 +1242,11 @@ options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to
#DDB, if available.
options CONSPEED=9600 #default speed for serial console (default 9600)
+# Solaris implements a new BREAK which is initiated by a character
+# sequence CR ~ ^b which is similar to a familiar pattern used on
+# Sun servers by the Remote Console.
+options ALT_BREAK_TO_DEBUGGER
+
# Options for sio:
options COM_ESP #code for Hayes ESP
options COM_MULTIPORT #code for some cards with shared IRQs
diff --git a/sys/conf/options b/sys/conf/options
index 91b96d9..7d614e9 100644
--- a/sys/conf/options
+++ b/sys/conf/options
@@ -427,6 +427,7 @@ METEOR_DEALLOC_ABOVE opt_meteor.h
COM_ESP opt_sio.h
COM_MULTIPORT opt_sio.h
BREAK_TO_DEBUGGER opt_comconsole.h
+ALT_BREAK_TO_DEBUGGER opt_comconsole.h
# Include tweaks for running under the SimOS machine simulator.
SIMOS opt_simos.h
diff --git a/sys/dev/sio/sio.c b/sys/dev/sio/sio.c
index 8a299bd..5fef0d9 100644
--- a/sys/dev/sio/sio.c
+++ b/sys/dev/sio/sio.c
@@ -1868,6 +1868,35 @@ siointr1(com)
recv_data = 0;
else
recv_data = inb(com->data_port);
+#if defined(DDB) && defined(ALT_BREAK_TO_DEBUGGER)
+ /*
+ * Solaris implements a new BREAK which is initiated
+ * by a character sequence CR ~ ^b which is similar
+ * to a familiar pattern used on Sun servers by the
+ * Remote Console.
+ */
+#define KEY_CRTLB 2 /* ^B */
+#define KEY_CR 13 /* CR '\r' */
+#define KEY_TILDE 126 /* ~ */
+
+ if (com->unit == comconsole) {
+ static int brk_state1 = 0, brk_state2 = 0;
+ if (recv_data == KEY_CR) {
+ brk_state1 = recv_data;
+ brk_state2 = 0;
+ } else if (brk_state1 == KEY_CR && (recv_data == KEY_TILDE || recv_data == KEY_CRTLB)) {
+ if (recv_data == KEY_TILDE)
+ brk_state2 = recv_data;
+ else if (brk_state2 == KEY_TILDE && recv_data == KEY_CRTLB) {
+ breakpoint();
+ brk_state1 = brk_state2 = 0;
+ goto cont;
+ } else
+ brk_state2 = 0;
+ } else
+ brk_state1 = 0;
+ }
+#endif
if (line_status & (LSR_BI | LSR_FE | LSR_PE)) {
/*
* Don't store BI if IGNBRK or FE/PE if IGNPAR.
diff --git a/sys/i386/conf/NOTES b/sys/i386/conf/NOTES
index 746dbae..305225d 100644
--- a/sys/i386/conf/NOTES
+++ b/sys/i386/conf/NOTES
@@ -1242,6 +1242,11 @@ options BREAK_TO_DEBUGGER #a BREAK on a comconsole goes to
#DDB, if available.
options CONSPEED=9600 #default speed for serial console (default 9600)
+# Solaris implements a new BREAK which is initiated by a character
+# sequence CR ~ ^b which is similar to a familiar pattern used on
+# Sun servers by the Remote Console.
+options ALT_BREAK_TO_DEBUGGER
+
# Options for sio:
options COM_ESP #code for Hayes ESP
options COM_MULTIPORT #code for some cards with shared IRQs
diff --git a/sys/isa/sio.c b/sys/isa/sio.c
index 8a299bd..5fef0d9 100644
--- a/sys/isa/sio.c
+++ b/sys/isa/sio.c
@@ -1868,6 +1868,35 @@ siointr1(com)
recv_data = 0;
else
recv_data = inb(com->data_port);
+#if defined(DDB) && defined(ALT_BREAK_TO_DEBUGGER)
+ /*
+ * Solaris implements a new BREAK which is initiated
+ * by a character sequence CR ~ ^b which is similar
+ * to a familiar pattern used on Sun servers by the
+ * Remote Console.
+ */
+#define KEY_CRTLB 2 /* ^B */
+#define KEY_CR 13 /* CR '\r' */
+#define KEY_TILDE 126 /* ~ */
+
+ if (com->unit == comconsole) {
+ static int brk_state1 = 0, brk_state2 = 0;
+ if (recv_data == KEY_CR) {
+ brk_state1 = recv_data;
+ brk_state2 = 0;
+ } else if (brk_state1 == KEY_CR && (recv_data == KEY_TILDE || recv_data == KEY_CRTLB)) {
+ if (recv_data == KEY_TILDE)
+ brk_state2 = recv_data;
+ else if (brk_state2 == KEY_TILDE && recv_data == KEY_CRTLB) {
+ breakpoint();
+ brk_state1 = brk_state2 = 0;
+ goto cont;
+ } else
+ brk_state2 = 0;
+ } else
+ brk_state1 = 0;
+ }
+#endif
if (line_status & (LSR_BI | LSR_FE | LSR_PE)) {
/*
* Don't store BI if IGNBRK or FE/PE if IGNPAR.
OpenPOWER on IntegriCloud