1 /*!**************************************************************************
5 *! DESCRIPTION: Implementation of the gdb stub with respect to ETRAX 100.
6 *! It is a mix of arch/m68k/kernel/kgdb.c and cris_stub.c.
8 *!---------------------------------------------------------------------------
13 *! Apr 26 1999 Hendrik Ruijter Initial version.
14 *! May 6 1999 Hendrik Ruijter Removed call to strlen in libc and removed
15 *! struct assignment as it generates calls to
17 *! Jun 17 1999 Hendrik Ruijter Added gdb 4.18 support. 'X', 'qC' and 'qL'.
18 *! Jul 21 1999 Bjorn Wesen eLinux port
21 *! Revision 1.4 2003/04/09 05:20:44 starvik
22 *! Merge of Linux 2.5.67
24 *! Revision 1.3 2003/01/21 19:11:08 starvik
25 *! Modified include path for new dir layout
27 *! Revision 1.2 2002/11/19 14:35:24 starvik
28 *! Changes from linux 2.4
29 *! Changed struct initializer syntax to the currently prefered notation
31 *! Revision 1.1 2001/12/17 13:59:27 bjornw
34 *! Revision 1.6 2001/10/09 13:10:03 matsfg
35 *! Added $ on registers and removed some underscores
37 *! Revision 1.5 2001/04/17 13:58:39 orjanf
38 *! * Renamed CONFIG_KGDB to CONFIG_ETRAX_KGDB.
40 *! Revision 1.4 2001/02/23 13:45:19 bjornw
43 *! Revision 1.3 2001/01/31 18:08:23 orjanf
44 *! Removed kgdb_handle_breakpoint from being the break 8 handler.
46 *! Revision 1.2 2001/01/12 14:22:25 orjanf
47 *! Updated kernel debugging support to work with ETRAX 100LX.
49 *! Revision 1.1 2000/07/10 16:25:21 bjornw
52 *! Revision 1.1.1.1 1999/12/03 14:57:31 bjornw
53 *! * Initial version of arch/cris, the latest CRIS architecture with an MMU.
54 *! Mostly copied from arch/etrax100 with appropriate renames of files.
55 *! The mm/ subdir is copied from arch/i386.
56 *! This does not compile yet at all.
59 *! Revision 1.4 1999/07/22 17:25:25 bjornw
60 *! Dont wait for + in putpacket if we havent hit the initial breakpoint yet. Added a kgdb_init function which sets up the break and irq vectors.
62 *! Revision 1.3 1999/07/21 19:51:18 bjornw
63 *! Check if the interrupting char is a ctrl-C, ignore otherwise.
65 *! Revision 1.2 1999/07/21 18:09:39 bjornw
66 *! Ported to eLinux architecture, and added some kgdb documentation.
69 *!---------------------------------------------------------------------------
71 *! $Id: kgdb.c,v 1.4 2003/04/09 05:20:44 starvik Exp $
73 *! (C) Copyright 1999, Axis Communications AB, LUND, SWEDEN
75 *!**************************************************************************/
76 /* @(#) cris_stub.c 1.3 06/17/99 */
82 * If you select CONFIG_ETRAX_KGDB in the configuration, the kernel will be
83 * built with different gcc flags: "-g" is added to get debug infos, and
84 * "-fomit-frame-pointer" is omitted to make debugging easier. Since the
85 * resulting kernel will be quite big (approx. > 7 MB), it will be stripped
86 * before compresion. Such a kernel will behave just as usually, except if
87 * given a "debug=<device>" command line option. (Only serial devices are
88 * allowed for <device>, i.e. no printers or the like; possible values are
89 * machine depedend and are the same as for the usual debug device, the one
90 * for logging kernel messages.) If that option is given and the device can be
91 * initialized, the kernel will connect to the remote gdb in trap_init(). The
92 * serial parameters are fixed to 8N1 and 115200 bps, for easyness of
95 * To start a debugging session, start that gdb with the debugging kernel
96 * image (the one with the symbols, vmlinux.debug) named on the command line.
97 * This file will be used by gdb to get symbol and debugging infos about the
98 * kernel. Next, select remote debug mode by
99 * target remote <device>
100 * where <device> is the name of the serial device over which the debugged
101 * machine is connected. Maybe you have to adjust the baud rate by
102 * set remotebaud <rate>
103 * or also other parameters with stty:
104 * shell stty ... </dev/...
105 * If the kernel to debug has already booted, it waited for gdb and now
106 * connects, and you'll see a breakpoint being reported. If the kernel isn't
107 * running yet, start it now. The order of gdb and the kernel doesn't matter.
108 * Another thing worth knowing about in the getting-started phase is how to
109 * debug the remote protocol itself. This is activated with
111 * gdb will then print out each packet sent or received. You'll also get some
112 * messages about the gdb stub on the console of the debugged machine.
114 * If all that works, you can use lots of the usual debugging techniques on
115 * the kernel, e.g. inspecting and changing variables/memory, setting
116 * breakpoints, single stepping and so on. It's also possible to interrupt the
117 * debugged kernel by pressing C-c in gdb. Have fun! :-)
119 * The gdb stub is entered (and thus the remote gdb gets control) in the
120 * following situations:
122 * - If breakpoint() is called. This is just after kgdb initialization, or if
123 * a breakpoint() call has been put somewhere into the kernel source.
124 * (Breakpoints can of course also be set the usual way in gdb.)
125 * In eLinux, we call breakpoint() in init/main.c after IRQ initialization.
127 * - If there is a kernel exception, i.e. bad_super_trap() or die_if_kernel()
128 * are entered. All the CPU exceptions are mapped to (more or less..., see
129 * the hard_trap_info array below) appropriate signal, which are reported
130 * to gdb. die_if_kernel() is usually called after some kind of access
131 * error and thus is reported as SIGSEGV.
133 * - When panic() is called. This is reported as SIGABRT.
135 * - If C-c is received over the serial line, which is treated as
138 * Of course, all these signals are just faked for gdb, since there is no
139 * signal concept as such for the kernel. It also isn't possible --obviously--
140 * to set signal handlers from inside gdb, or restart the kernel with a
143 * Current limitations:
145 * - While the kernel is stopped, interrupts are disabled for safety reasons
146 * (i.e., variables not changing magically or the like). But this also
147 * means that the clock isn't running anymore, and that interrupts from the
148 * hardware may get lost/not be served in time. This can cause some device
151 * - When single-stepping, only one instruction of the current thread is
152 * executed, but interrupts are allowed for that time and will be serviced
153 * if pending. Be prepared for that.
155 * - All debugging happens in kernel virtual address space. There's no way to
156 * access physical memory not mapped in kernel space, or to access user
157 * space. A way to work around this is using get_user_long & Co. in gdb
158 * expressions, but only for the current process.
160 * - Interrupting the kernel only works if interrupts are currently allowed,
161 * and the interrupt of the serial line isn't blocked by some other means
162 * (IPL too high, disabled, ...)
164 * - The gdb stub is currently not reentrant, i.e. errors that happen therein
165 * (e.g. accessing invalid memory) may not be caught correctly. This could
166 * be removed in future by introducing a stack of struct registers.
171 * To enable debugger support, two things need to happen. One, a
172 * call to kgdb_init() is necessary in order to allow any breakpoints
173 * or error conditions to be properly intercepted and reported to gdb.
174 * Two, a breakpoint needs to be generated to begin communication. This
175 * is most easily accomplished by a call to breakpoint().
177 * The following gdb commands are supported:
179 * command function Return value
181 * g return the value of the CPU registers hex data or ENN
182 * G set the value of the CPU registers OK or ENN
184 * mAA..AA,LLLL Read LLLL bytes at address AA..AA hex data or ENN
185 * MAA..AA,LLLL: Write LLLL bytes at address AA.AA OK or ENN
187 * c Resume at current address SNN ( signal NN)
188 * cAA..AA Continue at address AA..AA SNN
190 * s Step one instruction SNN
191 * sAA..AA Step one instruction from AA..AA SNN
195 * ? What was the last sigval ? SNN (signal NN)
197 * bBB..BB Set baud rate to BB..BB OK or BNN, then sets
200 * All commands and responses are sent with a packet which includes a
201 * checksum. A packet consists of
203 * $<packet info>#<checksum>.
206 * <packet info> :: <characters representing the command or response>
207 * <checksum> :: < two hex digits computed as modulo 256 sum of <packetinfo>>
209 * When a packet is received, it is first acknowledged with either '+' or '-'.
210 * '+' indicates a successful transfer. '-' indicates a failed transfer.
215 * $m0,10#2a +$00010203040506070809101112131415#42
220 #include <linux/string.h>
221 #include <linux/signal.h>
222 #include <linux/kernel.h>
223 #include <linux/delay.h>
224 #include <linux/linkage.h>
226 #include <asm/setup.h>
227 #include <asm/ptrace.h>
229 #include <asm/arch/svinto.h>
232 static int kgdb_started = 0;
234 /********************************* Register image ****************************/
235 /* Use the order of registers as defined in "AXIS ETRAX CRIS Programmer's
236 Reference", p. 1-1, with the additional register definitions of the
237 ETRAX 100LX in cris-opc.h.
238 There are 16 general 32-bit registers, R0-R15, where R14 is the stack
239 pointer, SP, and R15 is the program counter, PC.
240 There are 16 special registers, P0-P15, where three of the unimplemented
241 registers, P0, P4 and P8, are reserved as zero-registers. A read from
242 any of these registers returns zero and a write has no effect. */
245 struct register_image
248 unsigned int r0; /* 0x00 */
249 unsigned int r1; /* 0x04 */
250 unsigned int r2; /* 0x08 */
251 unsigned int r3; /* 0x0C */
252 unsigned int r4; /* 0x10 */
253 unsigned int r5; /* 0x14 */
254 unsigned int r6; /* 0x18 */
255 unsigned int r7; /* 0x1C */
256 unsigned int r8; /* 0x20 Frame pointer */
257 unsigned int r9; /* 0x24 */
258 unsigned int r10; /* 0x28 */
259 unsigned int r11; /* 0x2C */
260 unsigned int r12; /* 0x30 */
261 unsigned int r13; /* 0x34 */
262 unsigned int sp; /* 0x38 Stack pointer */
263 unsigned int pc; /* 0x3C Program counter */
265 unsigned char p0; /* 0x40 8-bit zero-register */
266 unsigned char vr; /* 0x41 Version register */
268 unsigned short p4; /* 0x42 16-bit zero-register */
269 unsigned short ccr; /* 0x44 Condition code register */
271 unsigned int mof; /* 0x46 Multiply overflow register */
273 unsigned int p8; /* 0x4A 32-bit zero-register */
274 unsigned int ibr; /* 0x4E Interrupt base register */
275 unsigned int irp; /* 0x52 Interrupt return pointer */
276 unsigned int srp; /* 0x56 Subroutine return pointer */
277 unsigned int bar; /* 0x5A Breakpoint address register */
278 unsigned int dccr; /* 0x5E Double condition code register */
279 unsigned int brp; /* 0x62 Breakpoint return pointer (pc in caller) */
280 unsigned int usp; /* 0x66 User mode stack pointer */
283 /************** Prototypes for local library functions ***********************/
285 /* Copy of strcpy from libc. */
286 static char *gdb_cris_strcpy (char *s1, const char *s2);
288 /* Copy of strlen from libc. */
289 static int gdb_cris_strlen (const char *s);
291 /* Copy of memchr from libc. */
292 static void *gdb_cris_memchr (const void *s, int c, int n);
294 /* Copy of strtol from libc. Does only support base 16. */
295 static int gdb_cris_strtol (const char *s, char **endptr, int base);
297 /********************** Prototypes for local functions. **********************/
298 /* Copy the content of a register image into another. The size n is
299 the size of the register image. Due to struct assignment generation of
301 static void copy_registers (registers *dptr, registers *sptr, int n);
303 /* Copy the stored registers from the stack. Put the register contents
304 of thread thread_id in the struct reg. */
305 static void copy_registers_from_stack (int thread_id, registers *reg);
307 /* Copy the registers to the stack. Put the register contents of thread
308 thread_id from struct reg to the stack. */
309 static void copy_registers_to_stack (int thread_id, registers *reg);
311 /* Write a value to a specified register regno in the register image
312 of the current thread. */
313 static int write_register (int regno, char *val);
315 /* Write a value to a specified register in the stack of a thread other
316 than the current thread. */
317 static write_stack_register (int thread_id, int regno, char *valptr);
319 /* Read a value from a specified register in the register image. Returns the
320 status of the read operation. The register value is returned in valptr. */
321 static int read_register (char regno, unsigned int *valptr);
323 /* Serial port, reads one character. ETRAX 100 specific. from debugport.c */
324 int getDebugChar (void);
326 /* Serial port, writes one character. ETRAX 100 specific. from debugport.c */
327 void putDebugChar (int val);
329 void enableDebugIRQ (void);
331 /* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
332 represented by int x. */
333 static char highhex (int x);
335 /* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
336 represented by int x. */
337 static char lowhex (int x);
339 /* Returns the integer equivalent of a hexadecimal character. */
340 static int hex (char ch);
342 /* Convert the memory, pointed to by mem into hexadecimal representation.
343 Put the result in buf, and return a pointer to the last character
345 static char *mem2hex (char *buf, unsigned char *mem, int count);
347 /* Convert the array, in hexadecimal representation, pointed to by buf into
348 binary representation. Put the result in mem, and return a pointer to
349 the character after the last byte written. */
350 static unsigned char *hex2mem (unsigned char *mem, char *buf, int count);
352 /* Put the content of the array, in binary representation, pointed to by buf
353 into memory pointed to by mem, and return a pointer to
354 the character after the last byte written. */
355 static unsigned char *bin2mem (unsigned char *mem, unsigned char *buf, int count);
357 /* Await the sequence $<data>#<checksum> and store <data> in the array buffer
359 static void getpacket (char *buffer);
361 /* Send $<data>#<checksum> from the <data> in the array buffer. */
362 static void putpacket (char *buffer);
364 /* Build and send a response packet in order to inform the host the
366 static void stub_is_stopped (int sigval);
368 /* All expected commands are sent from remote.c. Send a response according
369 to the description in remote.c. */
370 static void handle_exception (int sigval);
372 /* Performs a complete re-start from scratch. ETRAX specific. */
373 static void kill_restart (void);
375 /******************** Prototypes for global functions. ***********************/
377 /* The string str is prepended with the GDB printout token and sent. */
378 void putDebugString (const unsigned char *str, int length); /* used by etrax100ser.c */
380 /* The hook for both static (compiled) and dynamic breakpoints set by GDB.
381 ETRAX 100 specific. */
382 void handle_breakpoint (void); /* used by irq.c */
384 /* The hook for an interrupt generated by GDB. ETRAX 100 specific. */
385 void handle_interrupt (void); /* used by irq.c */
387 /* A static breakpoint to be used at startup. */
388 void breakpoint (void); /* called by init/main.c */
390 /* From osys_int.c, executing_task contains the number of the current
391 executing task in osys. Does not know of object-oriented threads. */
392 extern unsigned char executing_task;
394 /* The number of characters used for a 64 bit thread identifier. */
395 #define HEXCHARS_IN_THREAD_ID 16
397 /* Avoid warning as the internal_stack is not used in the C-code. */
398 #define USEDVAR(name) { if (name) { ; } }
399 #define USEDFUN(name) { void (*pf)(void) = (void *)name; USEDVAR(pf) }
401 /********************************** Packet I/O ******************************/
402 /* BUFMAX defines the maximum number of characters in
403 inbound/outbound buffers */
406 /* Run-length encoding maximum length. Send 64 at most. */
409 /* Definition of all valid hexadecimal characters */
410 static const char hexchars[] = "0123456789abcdef";
412 /* The inbound/outbound buffers used in packet I/O */
413 static char remcomInBuffer[BUFMAX];
414 static char remcomOutBuffer[BUFMAX];
416 /* Error and warning messages. */
419 SUCCESS, E01, E02, E03, E04, E05, E06, E07
421 static char *error_message[] =
424 "E01 Set current or general thread - H[c,g] - internal error.",
425 "E02 Change register content - P - cannot change read-only register.",
426 "E03 Thread is not alive.", /* T, not used. */
427 "E04 The command is not supported - [s,C,S,!,R,d,r] - internal error.",
428 "E05 Change register content - P - the register is not implemented..",
429 "E06 Change memory content - M - internal error.",
430 "E07 Change register content - P - the register is not stored on the stack"
432 /********************************* Register image ****************************/
433 /* Use the order of registers as defined in "AXIS ETRAX CRIS Programmer's
434 Reference", p. 1-1, with the additional register definitions of the
435 ETRAX 100LX in cris-opc.h.
436 There are 16 general 32-bit registers, R0-R15, where R14 is the stack
437 pointer, SP, and R15 is the program counter, PC.
438 There are 16 special registers, P0-P15, where three of the unimplemented
439 registers, P0, P4 and P8, are reserved as zero-registers. A read from
440 any of these registers returns zero and a write has no effect. */
453 /* The register sizes of the registers in register_name. An unimplemented register
454 is designated by size 0 in this array. */
455 static int register_size[] =
467 /* Contains the register image of the executing thread in the assembler
468 part of the code in order to avoid horrible addressing modes. */
469 static registers reg;
471 /* FIXME: Should this be used? Delete otherwise. */
472 /* Contains the assumed consistency state of the register image. Uses the
473 enum error_type for state information. */
474 static int consistency_status = SUCCESS;
476 /********************************** Handle exceptions ************************/
477 /* The variable reg contains the register image associated with the
478 current_thread_c variable. It is a complete register image created at
479 entry. The reg_g contains a register image of a task where the general
480 registers are taken from the stack and all special registers are taken
481 from the executing task. It is associated with current_thread_g and used
482 in order to provide access mainly for 'g', 'G' and 'P'.
485 /* Need two task id pointers in order to handle Hct and Hgt commands. */
486 static int current_thread_c = 0;
487 static int current_thread_g = 0;
489 /* Need two register images in order to handle Hct and Hgt commands. The
490 variable reg_g is in addition to reg above. */
491 static registers reg_g;
493 /********************************** Breakpoint *******************************/
494 /* Use an internal stack in the breakpoint and interrupt response routines */
495 #define INTERNAL_STACK_SIZE 1024
496 static char internal_stack[INTERNAL_STACK_SIZE];
498 /* Due to the breakpoint return pointer, a state variable is needed to keep
499 track of whether it is a static (compiled) or dynamic (gdb-invoked)
500 breakpoint to be handled. A static breakpoint uses the content of register
501 BRP as it is whereas a dynamic breakpoint requires subtraction with 2
502 in order to execute the instruction. The first breakpoint is static. */
503 static unsigned char is_dyn_brkp = 0;
505 /********************************* String library ****************************/
506 /* Single-step over library functions creates trap loops. */
508 /* Copy char s2[] to s1[]. */
510 gdb_cris_strcpy (char *s1, const char *s2)
514 for (s = s1; (*s++ = *s2++) != '\0'; )
519 /* Find length of s[]. */
521 gdb_cris_strlen (const char *s)
525 for (sc = s; *sc != '\0'; sc++)
530 /* Find first occurrence of c in s[n]. */
532 gdb_cris_memchr (const void *s, int c, int n)
534 const unsigned char uc = c;
535 const unsigned char *su;
537 for (su = s; 0 < n; ++su, --n)
542 /******************************* Standard library ****************************/
543 /* Single-step over library functions creates trap loops. */
544 /* Convert string to long. */
546 gdb_cris_strtol (const char *s, char **endptr, int base)
552 for (s1 = (char*)s; (sd = gdb_cris_memchr(hexchars, *s1, base)) != NULL; ++s1)
553 x = x * base + (sd - hexchars);
557 /* Unconverted suffix is stored in endptr unless endptr is NULL. */
570 /********************************* Register image ****************************/
571 /* Copy the content of a register image into another. The size n is
572 the size of the register image. Due to struct assignment generation of
575 copy_registers (registers *dptr, registers *sptr, int n)
580 for (dreg = (unsigned char*)dptr, sreg = (unsigned char*)sptr; n > 0; n--)
584 #ifdef PROCESS_SUPPORT
585 /* Copy the stored registers from the stack. Put the register contents
586 of thread thread_id in the struct reg. */
588 copy_registers_from_stack (int thread_id, registers *regptr)
591 stack_registers *s = (stack_registers *)stack_list[thread_id];
592 unsigned int *d = (unsigned int *)regptr;
594 for (j = 13; j >= 0; j--)
596 regptr->sp = (unsigned int)stack_list[thread_id];
598 regptr->dccr = s->dccr;
599 regptr->srp = s->srp;
602 /* Copy the registers to the stack. Put the register contents of thread
603 thread_id from struct reg to the stack. */
605 copy_registers_to_stack (int thread_id, registers *regptr)
608 stack_registers *d = (stack_registers *)stack_list[thread_id];
609 unsigned int *s = (unsigned int *)regptr;
611 for (i = 0; i < 14; i++) {
615 d->dccr = regptr->dccr;
616 d->srp = regptr->srp;
620 /* Write a value to a specified register in the register image of the current
621 thread. Returns status code SUCCESS, E02 or E05. */
623 write_register (int regno, char *val)
625 int status = SUCCESS;
626 registers *current_reg = ®
628 if (regno >= R0 && regno <= PC) {
629 /* 32-bit register with simple offset. */
630 hex2mem ((unsigned char *)current_reg + regno * sizeof(unsigned int),
631 val, sizeof(unsigned int));
633 else if (regno == P0 || regno == VR || regno == P4 || regno == P8) {
634 /* Do not support read-only registers. */
637 else if (regno == CCR) {
638 /* 16 bit register with complex offset. (P4 is read-only, P6 is not implemented,
639 and P7 (MOF) is 32 bits in ETRAX 100LX. */
640 hex2mem ((unsigned char *)&(current_reg->ccr) + (regno-CCR) * sizeof(unsigned short),
641 val, sizeof(unsigned short));
643 else if (regno >= MOF && regno <= USP) {
644 /* 32 bit register with complex offset. (P8 has been taken care of.) */
645 hex2mem ((unsigned char *)&(current_reg->ibr) + (regno-IBR) * sizeof(unsigned int),
646 val, sizeof(unsigned int));
649 /* Do not support nonexisting or unimplemented registers (P2, P3, and P6). */
655 #ifdef PROCESS_SUPPORT
656 /* Write a value to a specified register in the stack of a thread other
657 than the current thread. Returns status code SUCCESS or E07. */
659 write_stack_register (int thread_id, int regno, char *valptr)
661 int status = SUCCESS;
662 stack_registers *d = (stack_registers *)stack_list[thread_id];
665 hex2mem ((unsigned char *)&val, valptr, sizeof(unsigned int));
666 if (regno >= R0 && regno < SP) {
669 else if (regno == SP) {
670 stack_list[thread_id] = val;
672 else if (regno == PC) {
675 else if (regno == SRP) {
678 else if (regno == DCCR) {
682 /* Do not support registers in the current thread. */
689 /* Read a value from a specified register in the register image. Returns the
690 value in the register or -1 for non-implemented registers.
691 Should check consistency_status after a call which may be E05 after changes
692 in the implementation. */
694 read_register (char regno, unsigned int *valptr)
696 registers *current_reg = ®
698 if (regno >= R0 && regno <= PC) {
699 /* 32-bit register with simple offset. */
700 *valptr = *(unsigned int *)((char *)current_reg + regno * sizeof(unsigned int));
703 else if (regno == P0 || regno == VR) {
704 /* 8 bit register with complex offset. */
705 *valptr = (unsigned int)(*(unsigned char *)
706 ((char *)&(current_reg->p0) + (regno-P0) * sizeof(char)));
709 else if (regno == P4 || regno == CCR) {
710 /* 16 bit register with complex offset. */
711 *valptr = (unsigned int)(*(unsigned short *)
712 ((char *)&(current_reg->p4) + (regno-P4) * sizeof(unsigned short)));
715 else if (regno >= MOF && regno <= USP) {
716 /* 32 bit register with complex offset. */
717 *valptr = *(unsigned int *)((char *)&(current_reg->p8)
718 + (regno-P8) * sizeof(unsigned int));
722 /* Do not support nonexisting or unimplemented registers (P2, P3, and P6). */
723 consistency_status = E05;
728 /********************************** Packet I/O ******************************/
729 /* Returns the character equivalent of a nibble, bit 7, 6, 5, and 4 of a byte,
730 represented by int x. */
734 return hexchars[(x >> 4) & 0xf];
737 /* Returns the character equivalent of a nibble, bit 3, 2, 1, and 0 of a byte,
738 represented by int x. */
742 return hexchars[x & 0xf];
745 /* Returns the integer equivalent of a hexadecimal character. */
749 if ((ch >= 'a') && (ch <= 'f'))
750 return (ch - 'a' + 10);
751 if ((ch >= '0') && (ch <= '9'))
753 if ((ch >= 'A') && (ch <= 'F'))
754 return (ch - 'A' + 10);
758 /* Convert the memory, pointed to by mem into hexadecimal representation.
759 Put the result in buf, and return a pointer to the last character
762 static int do_printk = 0;
765 mem2hex(char *buf, unsigned char *mem, int count)
771 /* Bogus read from m0. FIXME: What constitutes a valid address? */
772 for (i = 0; i < count; i++) {
777 /* Valid mem address. */
778 for (i = 0; i < count; i++) {
780 *buf++ = highhex (ch);
781 *buf++ = lowhex (ch);
785 /* Terminate properly. */
790 /* Convert the array, in hexadecimal representation, pointed to by buf into
791 binary representation. Put the result in mem, and return a pointer to
792 the character after the last byte written. */
793 static unsigned char*
794 hex2mem (unsigned char *mem, char *buf, int count)
798 for (i = 0; i < count; i++) {
799 ch = hex (*buf++) << 4;
800 ch = ch + hex (*buf++);
806 /* Put the content of the array, in binary representation, pointed to by buf
807 into memory pointed to by mem, and return a pointer to the character after
808 the last byte written.
809 Gdb will escape $, #, and the escape char (0x7d). */
810 static unsigned char*
811 bin2mem (unsigned char *mem, unsigned char *buf, int count)
815 for (i = 0; i < count; i++) {
816 /* Check for any escaped characters. Be paranoid and
817 only unescape chars that should be escaped. */
820 if (*next == 0x3 || *next == 0x4 || *next == 0x5D) /* #, $, ESC */
831 /* Await the sequence $<data>#<checksum> and store <data> in the array buffer
834 getpacket (char *buffer)
836 unsigned char checksum;
837 unsigned char xmitcsum;
842 while ((ch = getDebugChar ()) != '$')
843 /* Wait for the start character $ and ignore all other characters */;
847 /* Read until a # or the end of the buffer is reached */
848 while (count < BUFMAX) {
849 ch = getDebugChar ();
852 checksum = checksum + ch;
856 buffer[count] = '\0';
859 xmitcsum = hex (getDebugChar ()) << 4;
860 xmitcsum += hex (getDebugChar ());
861 if (checksum != xmitcsum) {
866 /* Correct checksum */
868 /* If sequence characters are received, reply with them */
869 if (buffer[2] == ':') {
870 putDebugChar (buffer[0]);
871 putDebugChar (buffer[1]);
872 /* Remove the sequence characters from the buffer */
873 count = gdb_cris_strlen (buffer);
874 for (i = 3; i <= count; i++)
875 buffer[i - 3] = buffer[i];
879 } while (checksum != xmitcsum);
882 /* Send $<data>#<checksum> from the <data> in the array buffer. */
885 putpacket(char *buffer)
896 /* Do run length encoding */
900 while (runlen < RUNLENMAX && *src == src[runlen]) {
904 /* Got a useful amount */
907 encode = runlen + ' ' - 4;
908 putDebugChar (encode);
917 putDebugChar (highhex (checksum));
918 putDebugChar (lowhex (checksum));
919 } while(kgdb_started && (getDebugChar() != '+'));
922 /* The string str is prepended with the GDB printout token and sent. Required
923 in traditional implementations. */
925 putDebugString (const unsigned char *str, int length)
927 remcomOutBuffer[0] = 'O';
928 mem2hex(&remcomOutBuffer[1], (unsigned char *)str, length);
929 putpacket(remcomOutBuffer);
932 /********************************** Handle exceptions ************************/
933 /* Build and send a response packet in order to inform the host the
934 stub is stopped. TAAn...:r...;n...:r...;n...:r...;
936 n... = register number (hex)
937 r... = register contents
939 r... = thread process ID. This is a hex integer.
940 n... = other string not starting with valid hex digit.
941 gdb should ignore this n,r pair and go on to the next.
942 This way we can extend the protocol. */
944 stub_is_stopped(int sigval)
946 char *ptr = remcomOutBuffer;
949 unsigned int reg_cont;
952 /* Send trap type (converted to signal) */
955 *ptr++ = highhex (sigval);
956 *ptr++ = lowhex (sigval);
958 /* Send register contents. We probably only need to send the
959 * PC, frame pointer and stack pointer here. Other registers will be
960 * explicitely asked for. But for now, send all.
963 for (regno = R0; regno <= USP; regno++) {
964 /* Store n...:r...; for the registers in the buffer. */
966 status = read_register (regno, ®_cont);
968 if (status == SUCCESS) {
970 *ptr++ = highhex (regno);
971 *ptr++ = lowhex (regno);
974 ptr = mem2hex(ptr, (unsigned char *)®_cont,
975 register_size[regno]);
981 #ifdef PROCESS_SUPPORT
982 /* Store the registers of the executing thread. Assume that both step,
983 continue, and register content requests are with respect to this
984 thread. The executing task is from the operating system scheduler. */
986 current_thread_c = executing_task;
987 current_thread_g = executing_task;
989 /* A struct assignment translates into a libc memcpy call. Avoid
990 all libc functions in order to prevent recursive break points. */
991 copy_registers (®_g, ®, sizeof(registers));
993 /* Store thread:r...; with the executing task TID. */
994 gdb_cris_strcpy (&remcomOutBuffer[pos], "thread:");
995 pos += gdb_cris_strlen ("thread:");
996 remcomOutBuffer[pos++] = highhex (executing_task);
997 remcomOutBuffer[pos++] = lowhex (executing_task);
998 gdb_cris_strcpy (&remcomOutBuffer[pos], ";");
1001 /* null-terminate and send it off */
1005 putpacket (remcomOutBuffer);
1008 /* All expected commands are sent from remote.c. Send a response according
1009 to the description in remote.c. */
1011 handle_exception (int sigval)
1013 /* Avoid warning of not used. */
1015 USEDFUN(handle_exception);
1016 USEDVAR(internal_stack[0]);
1018 /* Send response. */
1020 stub_is_stopped (sigval);
1023 remcomOutBuffer[0] = '\0';
1024 getpacket (remcomInBuffer);
1025 switch (remcomInBuffer[0]) {
1027 /* Read registers: g
1028 Success: Each byte of register data is described by two hex digits.
1029 Registers are in the internal order for GDB, and the bytes
1030 in a register are in the same order the machine uses.
1034 #ifdef PROCESS_SUPPORT
1035 /* Use the special register content in the executing thread. */
1036 copy_registers (®_g, ®, sizeof(registers));
1037 /* Replace the content available on the stack. */
1038 if (current_thread_g != executing_task) {
1039 copy_registers_from_stack (current_thread_g, ®_g);
1041 mem2hex ((unsigned char *)remcomOutBuffer, (unsigned char *)®_g, sizeof(registers));
1043 mem2hex(remcomOutBuffer, (char *)®, sizeof(registers));
1049 /* Write registers. GXX..XX
1050 Each byte of register data is described by two hex digits.
1053 #ifdef PROCESS_SUPPORT
1054 hex2mem ((unsigned char *)®_g, &remcomInBuffer[1], sizeof(registers));
1055 if (current_thread_g == executing_task) {
1056 copy_registers (®, ®_g, sizeof(registers));
1059 copy_registers_to_stack(current_thread_g, ®_g);
1062 hex2mem((char *)®, &remcomInBuffer[1], sizeof(registers));
1064 gdb_cris_strcpy (remcomOutBuffer, "OK");
1068 /* Write register. Pn...=r...
1069 Write register n..., hex value without 0x, with value r...,
1070 which contains a hex value without 0x and two hex digits
1071 for each byte in the register (target byte order). P1f=11223344 means
1072 set register 31 to 44332211.
1074 Failure: E02, E05 */
1077 int regno = gdb_cris_strtol (&remcomInBuffer[1], &suffix, 16);
1079 #ifdef PROCESS_SUPPORT
1080 if (current_thread_g != executing_task)
1081 status = write_stack_register (current_thread_g, regno, suffix+1);
1084 status = write_register (regno, suffix+1);
1088 /* Do not support read-only registers. */
1089 gdb_cris_strcpy (remcomOutBuffer, error_message[E02]);
1092 /* Do not support non-existing registers. */
1093 gdb_cris_strcpy (remcomOutBuffer, error_message[E05]);
1096 /* Do not support non-existing registers on the stack. */
1097 gdb_cris_strcpy (remcomOutBuffer, error_message[E07]);
1100 /* Valid register number. */
1101 gdb_cris_strcpy (remcomOutBuffer, "OK");
1108 /* Read from memory. mAA..AA,LLLL
1109 AA..AA is the address and LLLL is the length.
1110 Success: XX..XX is the memory content. Can be fewer bytes than
1111 requested if only part of the data may be read. m6000120a,6c means
1112 retrieve 108 byte from base address 6000120a.
1116 unsigned char *addr = (unsigned char *)gdb_cris_strtol(&remcomInBuffer[1],
1117 &suffix, 16); int length = gdb_cris_strtol(suffix+1, 0, 16);
1119 mem2hex(remcomOutBuffer, addr, length);
1124 /* Write to memory. XAA..AA,LLLL:XX..XX
1125 AA..AA is the start address, LLLL is the number of bytes, and
1126 XX..XX is the binary data.
1130 /* Write to memory. MAA..AA,LLLL:XX..XX
1131 AA..AA is the start address, LLLL is the number of bytes, and
1132 XX..XX is the hexadecimal data.
1138 unsigned char *addr = (unsigned char *)gdb_cris_strtol(&remcomInBuffer[1],
1140 int length = gdb_cris_strtol(lenptr+1, &dataptr, 16);
1141 if (*lenptr == ',' && *dataptr == ':') {
1142 if (remcomInBuffer[0] == 'M') {
1143 hex2mem(addr, dataptr + 1, length);
1146 bin2mem(addr, dataptr + 1, length);
1148 gdb_cris_strcpy (remcomOutBuffer, "OK");
1151 gdb_cris_strcpy (remcomOutBuffer, error_message[E06]);
1157 /* Continue execution. cAA..AA
1158 AA..AA is the address where execution is resumed. If AA..AA is
1159 omitted, resume at the present address.
1160 Success: return to the executing thread.
1161 Failure: will never know. */
1162 if (remcomInBuffer[1] != '\0') {
1163 reg.pc = gdb_cris_strtol (&remcomInBuffer[1], 0, 16);
1170 AA..AA is the address where execution is resumed. If AA..AA is
1171 omitted, resume at the present address. Success: return to the
1172 executing thread. Failure: will never know.
1174 Should never be invoked. The single-step is implemented on
1175 the host side. If ever invoked, it is an internal error E04. */
1176 gdb_cris_strcpy (remcomOutBuffer, error_message[E04]);
1177 putpacket (remcomOutBuffer);
1181 /* The last signal which caused a stop. ?
1182 Success: SAA, where AA is the signal number.
1184 remcomOutBuffer[0] = 'S';
1185 remcomOutBuffer[1] = highhex (sigval);
1186 remcomOutBuffer[2] = lowhex (sigval);
1187 remcomOutBuffer[3] = 0;
1191 /* Detach from host. D
1192 Success: OK, and return to the executing thread.
1193 Failure: will never know */
1199 /* kill request or reset request.
1200 Success: restart of target.
1201 Failure: will never know. */
1210 /* Continue with signal sig. Csig;AA..AA
1211 Step with signal sig. Ssig;AA..AA
1212 Use the extended remote protocol. !
1213 Restart the target system. R0
1214 Toggle debug flag. d
1215 Search backwards. tAA:PP,MM
1216 Not supported: E04 */
1217 gdb_cris_strcpy (remcomOutBuffer, error_message[E04]);
1219 #ifdef PROCESS_SUPPORT
1222 /* Thread alive. TXX
1224 Success: OK, thread XX is alive.
1225 Failure: E03, thread XX is dead. */
1227 int thread_id = (int)gdb_cris_strtol (&remcomInBuffer[1], 0, 16);
1228 /* Cannot tell whether it is alive or not. */
1229 if (thread_id >= 0 && thread_id < number_of_tasks)
1230 gdb_cris_strcpy (remcomOutBuffer, "OK");
1235 /* Set thread for subsequent operations: Hct
1236 c = 'c' for thread used in step and continue;
1237 t can be -1 for all threads.
1238 c = 'g' for thread used in other operations.
1239 t = 0 means pick any thread.
1243 int thread_id = gdb_cris_strtol (&remcomInBuffer[2], 0, 16);
1244 if (remcomInBuffer[1] == 'c') {
1245 /* c = 'c' for thread used in step and continue */
1246 /* Do not change current_thread_c here. It would create a mess in
1248 gdb_cris_strcpy (remcomOutBuffer, "OK");
1250 else if (remcomInBuffer[1] == 'g') {
1251 /* c = 'g' for thread used in other operations.
1252 t = 0 means pick any thread. Impossible since the scheduler does
1254 if (thread_id >= 0 && thread_id < number_of_tasks) {
1255 current_thread_g = thread_id;
1256 gdb_cris_strcpy (remcomOutBuffer, "OK");
1259 /* Not expected - send an error message. */
1260 gdb_cris_strcpy (remcomOutBuffer, error_message[E01]);
1264 /* Not expected - send an error message. */
1265 gdb_cris_strcpy (remcomOutBuffer, error_message[E01]);
1272 /* Query of general interest. qXXXX
1273 Set general value XXXX. QXXXX=yyyy */
1279 switch (remcomInBuffer[1]) {
1281 /* Identify the remote current thread. */
1282 gdb_cris_strcpy (&remcomOutBuffer[0], "QC");
1283 remcomOutBuffer[2] = highhex (current_thread_c);
1284 remcomOutBuffer[3] = lowhex (current_thread_c);
1285 remcomOutBuffer[4] = '\0';
1288 gdb_cris_strcpy (&remcomOutBuffer[0], "QM");
1289 /* Reply with number of threads. */
1290 if (os_is_started()) {
1291 remcomOutBuffer[2] = highhex (number_of_tasks);
1292 remcomOutBuffer[3] = lowhex (number_of_tasks);
1295 remcomOutBuffer[2] = highhex (0);
1296 remcomOutBuffer[3] = lowhex (1);
1298 /* Done with the reply. */
1299 remcomOutBuffer[4] = lowhex (1);
1301 /* Expects the argument thread id. */
1302 for (; pos < (5 + HEXCHARS_IN_THREAD_ID); pos++)
1303 remcomOutBuffer[pos] = remcomInBuffer[pos];
1304 /* Reply with the thread identifiers. */
1305 if (os_is_started()) {
1306 /* Store the thread identifiers of all tasks. */
1307 for (thread_id = 0; thread_id < number_of_tasks; thread_id++) {
1308 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1;
1309 for (; pos < nextpos; pos ++)
1310 remcomOutBuffer[pos] = lowhex (0);
1311 remcomOutBuffer[pos++] = lowhex (thread_id);
1315 /* Store the thread identifier of the boot task. */
1316 nextpos = pos + HEXCHARS_IN_THREAD_ID - 1;
1317 for (; pos < nextpos; pos ++)
1318 remcomOutBuffer[pos] = lowhex (0);
1319 remcomOutBuffer[pos++] = lowhex (current_thread_c);
1321 remcomOutBuffer[pos] = '\0';
1324 /* Not supported: "" */
1325 /* Request information about section offsets: qOffsets. */
1326 remcomOutBuffer[0] = 0;
1331 #endif /* PROCESS_SUPPORT */
1334 /* The stub should ignore other request and send an empty
1335 response ($#<checksum>). This way we can extend the protocol and GDB
1336 can tell whether the stub it is talking to uses the old or the new. */
1337 remcomOutBuffer[0] = 0;
1340 putpacket(remcomOutBuffer);
1344 /* The jump is to the address 0x00000002. Performs a complete re-start
1349 __asm__ volatile ("jump 2");
1352 /********************************** Breakpoint *******************************/
1353 /* The hook for both a static (compiled) and a dynamic breakpoint set by GDB.
1354 An internal stack is used by the stub. The register image of the caller is
1355 stored in the structure register_image.
1356 Interactive communication with the host is handled by handle_exception and
1357 finally the register image is restored. */
1359 void kgdb_handle_breakpoint(void);
1362 .global kgdb_handle_breakpoint
1363 kgdb_handle_breakpoint:
1365 ;; Response to the break-instruction
1367 ;; Create a register image of the caller
1369 move $dccr,[reg+0x5E] ; Save the flags in DCCR before disable interrupts
1370 di ; Disable interrupts
1371 move.d $r0,[reg] ; Save R0
1372 move.d $r1,[reg+0x04] ; Save R1
1373 move.d $r2,[reg+0x08] ; Save R2
1374 move.d $r3,[reg+0x0C] ; Save R3
1375 move.d $r4,[reg+0x10] ; Save R4
1376 move.d $r5,[reg+0x14] ; Save R5
1377 move.d $r6,[reg+0x18] ; Save R6
1378 move.d $r7,[reg+0x1C] ; Save R7
1379 move.d $r8,[reg+0x20] ; Save R8
1380 move.d $r9,[reg+0x24] ; Save R9
1381 move.d $r10,[reg+0x28] ; Save R10
1382 move.d $r11,[reg+0x2C] ; Save R11
1383 move.d $r12,[reg+0x30] ; Save R12
1384 move.d $r13,[reg+0x34] ; Save R13
1385 move.d $sp,[reg+0x38] ; Save SP (R14)
1386 ;; Due to the old assembler-versions BRP might not be recognized
1387 .word 0xE670 ; move brp,$r0
1388 subq 2,$r0 ; Set to address of previous instruction.
1389 move.d $r0,[reg+0x3c] ; Save the address in PC (R15)
1390 clear.b [reg+0x40] ; Clear P0
1391 move $vr,[reg+0x41] ; Save special register P1
1392 clear.w [reg+0x42] ; Clear P4
1393 move $ccr,[reg+0x44] ; Save special register CCR
1394 move $mof,[reg+0x46] ; P7
1395 clear.d [reg+0x4A] ; Clear P8
1396 move $ibr,[reg+0x4E] ; P9,
1397 move $irp,[reg+0x52] ; P10,
1398 move $srp,[reg+0x56] ; P11,
1399 move $dtp0,[reg+0x5A] ; P12, register BAR, assembler might not know BAR
1400 ; P13, register DCCR already saved
1401 ;; Due to the old assembler-versions BRP might not be recognized
1402 .word 0xE670 ; move brp,r0
1403 ;; Static (compiled) breakpoints must return to the next instruction in order
1404 ;; to avoid infinite loops. Dynamic (gdb-invoked) must restore the instruction
1405 ;; in order to execute it when execution is continued.
1406 test.b [is_dyn_brkp] ; Is this a dynamic breakpoint?
1407 beq is_static ; No, a static breakpoint
1409 subq 2,$r0 ; rerun the instruction the break replaced
1412 move.b $r1,[is_dyn_brkp] ; Set the state variable to dynamic breakpoint
1413 move.d $r0,[reg+0x62] ; Save the return address in BRP
1414 move $usp,[reg+0x66] ; USP
1416 ;; Handle the communication
1418 move.d internal_stack+1020,$sp ; Use the internal stack which grows upward
1419 moveq 5,$r10 ; SIGTRAP
1420 jsr handle_exception ; Interactive routine
1422 ;; Return to the caller
1424 move.d [reg],$r0 ; Restore R0
1425 move.d [reg+0x04],$r1 ; Restore R1
1426 move.d [reg+0x08],$r2 ; Restore R2
1427 move.d [reg+0x0C],$r3 ; Restore R3
1428 move.d [reg+0x10],$r4 ; Restore R4
1429 move.d [reg+0x14],$r5 ; Restore R5
1430 move.d [reg+0x18],$r6 ; Restore R6
1431 move.d [reg+0x1C],$r7 ; Restore R7
1432 move.d [reg+0x20],$r8 ; Restore R8
1433 move.d [reg+0x24],$r9 ; Restore R9
1434 move.d [reg+0x28],$r10 ; Restore R10
1435 move.d [reg+0x2C],$r11 ; Restore R11
1436 move.d [reg+0x30],$r12 ; Restore R12
1437 move.d [reg+0x34],$r13 ; Restore R13
1439 ;; FIXME: Which registers should be restored?
1441 move.d [reg+0x38],$sp ; Restore SP (R14)
1442 move [reg+0x56],$srp ; Restore the subroutine return pointer.
1443 move [reg+0x5E],$dccr ; Restore DCCR
1444 move [reg+0x66],$usp ; Restore USP
1445 jump [reg+0x62] ; A jump to the content in register BRP works.
1449 /* The hook for an interrupt generated by GDB. An internal stack is used
1450 by the stub. The register image of the caller is stored in the structure
1451 register_image. Interactive communication with the host is handled by
1452 handle_exception and finally the register image is restored. Due to the
1453 old assembler which does not recognise the break instruction and the
1454 breakpoint return pointer hex-code is used. */
1456 void kgdb_handle_serial(void);
1459 .global kgdb_handle_serial
1462 ;; Response to a serial interrupt
1465 move $dccr,[reg+0x5E] ; Save the flags in DCCR
1466 di ; Disable interrupts
1467 move.d $r0,[reg] ; Save R0
1468 move.d $r1,[reg+0x04] ; Save R1
1469 move.d $r2,[reg+0x08] ; Save R2
1470 move.d $r3,[reg+0x0C] ; Save R3
1471 move.d $r4,[reg+0x10] ; Save R4
1472 move.d $r5,[reg+0x14] ; Save R5
1473 move.d $r6,[reg+0x18] ; Save R6
1474 move.d $r7,[reg+0x1C] ; Save R7
1475 move.d $r8,[reg+0x20] ; Save R8
1476 move.d $r9,[reg+0x24] ; Save R9
1477 move.d $r10,[reg+0x28] ; Save R10
1478 move.d $r11,[reg+0x2C] ; Save R11
1479 move.d $r12,[reg+0x30] ; Save R12
1480 move.d $r13,[reg+0x34] ; Save R13
1481 move.d $sp,[reg+0x38] ; Save SP (R14)
1482 move $irp,[reg+0x3c] ; Save the address in PC (R15)
1483 clear.b [reg+0x40] ; Clear P0
1484 move $vr,[reg+0x41] ; Save special register P1,
1485 clear.w [reg+0x42] ; Clear P4
1486 move $ccr,[reg+0x44] ; Save special register CCR
1487 move $mof,[reg+0x46] ; P7
1488 clear.d [reg+0x4A] ; Clear P8
1489 move $ibr,[reg+0x4E] ; P9,
1490 move $irp,[reg+0x52] ; P10,
1491 move $srp,[reg+0x56] ; P11,
1492 move $dtp0,[reg+0x5A] ; P12, register BAR, assembler might not know BAR
1493 ; P13, register DCCR already saved
1494 ;; Due to the old assembler-versions BRP might not be recognized
1495 .word 0xE670 ; move brp,r0
1496 move.d $r0,[reg+0x62] ; Save the return address in BRP
1497 move $usp,[reg+0x66] ; USP
1499 ;; get the serial character (from debugport.c) and check if it is a ctrl-c
1507 ;; Handle the communication
1509 move.d internal_stack+1020,$sp ; Use the internal stack
1510 moveq 2,$r10 ; SIGINT
1511 jsr handle_exception ; Interactive routine
1515 ;; Return to the caller
1517 move.d [reg],$r0 ; Restore R0
1518 move.d [reg+0x04],$r1 ; Restore R1
1519 move.d [reg+0x08],$r2 ; Restore R2
1520 move.d [reg+0x0C],$r3 ; Restore R3
1521 move.d [reg+0x10],$r4 ; Restore R4
1522 move.d [reg+0x14],$r5 ; Restore R5
1523 move.d [reg+0x18],$r6 ; Restore R6
1524 move.d [reg+0x1C],$r7 ; Restore R7
1525 move.d [reg+0x20],$r8 ; Restore R8
1526 move.d [reg+0x24],$r9 ; Restore R9
1527 move.d [reg+0x28],$r10 ; Restore R10
1528 move.d [reg+0x2C],$r11 ; Restore R11
1529 move.d [reg+0x30],$r12 ; Restore R12
1530 move.d [reg+0x34],$r13 ; Restore R13
1532 ;; FIXME: Which registers should be restored?
1534 move.d [reg+0x38],$sp ; Restore SP (R14)
1535 move [reg+0x56],$srp ; Restore the subroutine return pointer.
1536 move [reg+0x5E],$dccr ; Restore DCCR
1537 move [reg+0x66],$usp ; Restore USP
1538 reti ; Return from the interrupt routine
1542 /* Use this static breakpoint in the start-up only. */
1548 is_dyn_brkp = 0; /* This is a static, not a dynamic breakpoint. */
1549 __asm__ volatile ("break 8"); /* Jump to handle_breakpoint. */
1552 /* initialize kgdb. doesn't break into the debugger, but sets up irq and ports */
1557 /* could initialize debug port as well but it's done in head.S already... */
1559 /* breakpoint handler is now set in irq.c */
1560 set_int_vector(8, kgdb_handle_serial, 0);
1565 /****************************** End of file **********************************/