<?xml version="1.0" encoding="ANSI_X3.4-1968" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=ANSI_X3.4-1968" /><title>kgdboc internals</title><meta name="generator" content="DocBook XSL Stylesheets V1.75.2" /><link rel="home" href="index.html" title="Using kgdb and the kgdb Internals" /><link rel="up" href="ch06.html" title="Chapter 6. KGDB Internals" /><link rel="prev" href="re13.html" title="struct kgdb_io" /><link rel="next" href="ch07.html" title="Chapter 7. Credits" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">kgdboc internals</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="re13.html">Prev</a> </td><th width="60%" align="center">Chapter 6. KGDB Internals</th><td width="20%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr></table><hr /></div><div class="sect1" title="kgdboc internals"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="kgdbocDesign"></a>kgdboc internals</h2></div></div></div><p> The kgdboc driver is actually a very thin driver that relies on the underlying low level to the hardware driver having "polling hooks" which the to which the tty driver is attached. In the initial implementation of kgdboc it the serial_core was changed to expose a low level uart hook for doing polled mode reading and writing of a single character while in an atomic context. When kgdb makes an I/O request to the debugger, kgdboc invokes a call back in the serial core which in turn uses the call back in the uart driver. It is certainly possible to extend kgdboc to work with non-uart based consoles in the future. </p><p> When using kgdboc with a uart, the uart driver must implement two callbacks in the <code class="constant">struct uart_ops</code>. Example from drivers/8250.c:</p><pre class="programlisting"> #ifdef CONFIG_CONSOLE_POLL .poll_get_char = serial8250_get_poll_char, .poll_put_char = serial8250_put_poll_char, #endif </pre><p> Any implementation specifics around creating a polling driver use the <code class="constant">#ifdef CONFIG_CONSOLE_POLL</code>, as shown above. Keep in mind that polling hooks have to be implemented in such a way that they can be called from an atomic context and have to restore the state of the uart chip on return such that the system can return to normal when the debugger detaches. You need to be very careful with any kind of lock you consider, because failing here is most going to mean pressing the reset button. </p></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="re13.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="ch06.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="ch07.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top"><span>struct kgdb_io</span> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 7. Credits</td></tr></table></div></body></html>