Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* gdb-stub.h: FRV GDB stub |
| 2 | * |
| 3 | * Copyright (C) 2003 Red Hat, Inc. All Rights Reserved. |
| 4 | * Written by David Howells (dhowells@redhat.com) |
| 5 | * - Derived from asm-mips/gdb-stub.h (c) 1995 Andreas Busse |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or |
| 8 | * modify it under the terms of the GNU General Public License |
| 9 | * as published by the Free Software Foundation; either version |
| 10 | * 2 of the License, or (at your option) any later version. |
| 11 | */ |
| 12 | #ifndef __ASM_GDB_STUB_H |
| 13 | #define __ASM_GDB_STUB_H |
| 14 | |
David Howells | 7ca8b9c | 2010-05-24 14:32:54 -0700 | [diff] [blame] | 15 | #undef GDBSTUB_DEBUG_IO |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 16 | #undef GDBSTUB_DEBUG_PROTOCOL |
| 17 | |
| 18 | #include <asm/ptrace.h> |
| 19 | |
| 20 | /* |
| 21 | * important register numbers in GDB protocol |
| 22 | * - GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7, |
| 23 | * - GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15, |
| 24 | * - GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23, |
| 25 | * - GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31, |
| 26 | * - GR32, GR33, GR34, GR35, GR36, GR37, GR38, GR39, |
| 27 | * - GR40, GR41, GR42, GR43, GR44, GR45, GR46, GR47, |
| 28 | * - GR48, GR49, GR50, GR51, GR52, GR53, GR54, GR55, |
| 29 | * - GR56, GR57, GR58, GR59, GR60, GR61, GR62, GR63, |
| 30 | * - FR0, FR1, FR2, FR3, FR4, FR5, FR6, FR7, |
| 31 | * - FR8, FR9, FR10, FR11, FR12, FR13, FR14, FR15, |
| 32 | * - FR16, FR17, FR18, FR19, FR20, FR21, FR22, FR23, |
| 33 | * - FR24, FR25, FR26, FR27, FR28, FR29, FR30, FR31, |
| 34 | * - FR32, FR33, FR34, FR35, FR36, FR37, FR38, FR39, |
| 35 | * - FR40, FR41, FR42, FR43, FR44, FR45, FR46, FR47, |
| 36 | * - FR48, FR49, FR50, FR51, FR52, FR53, FR54, FR55, |
| 37 | * - FR56, FR57, FR58, FR59, FR60, FR61, FR62, FR63, |
| 38 | * - PC, PSR, CCR, CCCR, |
| 39 | * - _X132, _X133, _X134 |
| 40 | * - TBR, BRR, DBAR0, DBAR1, DBAR2, DBAR3, |
| 41 | * - SCR0, SCR1, SCR2, SCR3, |
| 42 | * - LR, LCR, |
| 43 | * - IACC0H, IACC0L, |
| 44 | * - FSR0, |
| 45 | * - ACC0, ACC1, ACC2, ACC3, ACC4, ACC5, ACC6, ACC7, |
| 46 | * - ACCG0123, ACCG4567, |
| 47 | * - MSR0, MSR1, |
| 48 | * - GNER0, GNER1, |
| 49 | * - FNER0, FNER1, |
| 50 | */ |
| 51 | #define GDB_REG_GR(N) (N) |
| 52 | #define GDB_REG_FR(N) (64+(N)) |
| 53 | #define GDB_REG_PC 128 |
| 54 | #define GDB_REG_PSR 129 |
| 55 | #define GDB_REG_CCR 130 |
| 56 | #define GDB_REG_CCCR 131 |
| 57 | #define GDB_REG_TBR 135 |
| 58 | #define GDB_REG_BRR 136 |
| 59 | #define GDB_REG_DBAR(N) (137+(N)) |
| 60 | #define GDB_REG_SCR(N) (141+(N)) |
| 61 | #define GDB_REG_LR 145 |
| 62 | #define GDB_REG_LCR 146 |
| 63 | #define GDB_REG_FSR0 149 |
| 64 | #define GDB_REG_ACC(N) (150+(N)) |
| 65 | #define GDB_REG_ACCG(N) (158+(N)/4) |
| 66 | #define GDB_REG_MSR(N) (160+(N)) |
| 67 | #define GDB_REG_GNER(N) (162+(N)) |
| 68 | #define GDB_REG_FNER(N) (164+(N)) |
| 69 | |
| 70 | #define GDB_REG_SP GDB_REG_GR(1) |
| 71 | #define GDB_REG_FP GDB_REG_GR(2) |
| 72 | |
| 73 | #ifndef _LANGUAGE_ASSEMBLY |
| 74 | |
| 75 | /* |
| 76 | * Prototypes |
| 77 | */ |
| 78 | extern void show_registers_only(struct pt_regs *regs); |
| 79 | |
| 80 | extern void gdbstub_init(void); |
| 81 | extern void gdbstub(int type); |
| 82 | extern void gdbstub_exit(int status); |
| 83 | |
| 84 | extern void gdbstub_io_init(void); |
| 85 | extern void gdbstub_set_baud(unsigned baud); |
| 86 | extern int gdbstub_rx_char(unsigned char *_ch, int nonblock); |
| 87 | extern void gdbstub_tx_char(unsigned char ch); |
| 88 | extern void gdbstub_tx_flush(void); |
| 89 | extern void gdbstub_do_rx(void); |
| 90 | |
| 91 | extern asmlinkage void __debug_stub_init_break(void); |
| 92 | extern asmlinkage void __break_hijack_kernel_event(void); |
David Howells | 84e8cd6 | 2006-07-10 04:44:55 -0700 | [diff] [blame] | 93 | extern asmlinkage void __break_hijack_kernel_event_breaks_here(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | |
| 95 | extern asmlinkage void gdbstub_rx_handler(void); |
| 96 | extern asmlinkage void gdbstub_rx_irq(void); |
| 97 | extern asmlinkage void gdbstub_intercept(void); |
| 98 | |
| 99 | extern uint32_t __entry_usertrap_table[]; |
| 100 | extern uint32_t __entry_kerneltrap_table[]; |
| 101 | |
| 102 | extern volatile u8 gdbstub_rx_buffer[PAGE_SIZE]; |
| 103 | extern volatile u32 gdbstub_rx_inp; |
| 104 | extern volatile u32 gdbstub_rx_outp; |
| 105 | extern volatile u8 gdbstub_rx_overflow; |
| 106 | extern u8 gdbstub_rx_unget; |
| 107 | |
| 108 | extern void gdbstub_printk(const char *fmt, ...); |
| 109 | extern void debug_to_serial(const char *p, int n); |
| 110 | extern void console_set_baud(unsigned baud); |
| 111 | |
David Howells | 7ca8b9c | 2010-05-24 14:32:54 -0700 | [diff] [blame] | 112 | #ifdef GDBSTUB_DEBUG_IO |
| 113 | #define gdbstub_io(FMT,...) gdbstub_printk(FMT, ##__VA_ARGS__) |
| 114 | #else |
| 115 | #define gdbstub_io(FMT,...) ({ 0; }) |
| 116 | #endif |
| 117 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 118 | #ifdef GDBSTUB_DEBUG_PROTOCOL |
| 119 | #define gdbstub_proto(FMT,...) gdbstub_printk(FMT,##__VA_ARGS__) |
| 120 | #else |
| 121 | #define gdbstub_proto(FMT,...) ({ 0; }) |
| 122 | #endif |
| 123 | |
David Howells | 84e8cd6 | 2006-07-10 04:44:55 -0700 | [diff] [blame] | 124 | /* |
| 125 | * we dedicate GR31 to keeping a pointer to the gdbstub exception frame |
| 126 | * - gr31 is destroyed on entry to the gdbstub if !MMU |
| 127 | * - gr31 is saved in scr3 on entry to the gdbstub if in !MMU |
| 128 | */ |
| 129 | register struct frv_frame0 *__debug_frame0 asm("gr31"); |
| 130 | |
| 131 | #define __debug_frame (&__debug_frame0->regs) |
| 132 | #define __debug_user_context (&__debug_frame0->uc) |
| 133 | #define __debug_regs (&__debug_frame0->debug) |
| 134 | #define __debug_reg(X) ((unsigned long *) ((unsigned long) &__debug_frame0 + (X))) |
| 135 | |
| 136 | struct frv_debug_status { |
| 137 | unsigned long bpsr; |
| 138 | unsigned long dcr; |
| 139 | unsigned long brr; |
| 140 | unsigned long nmar; |
| 141 | }; |
| 142 | |
| 143 | extern struct frv_debug_status __debug_status; |
| 144 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | #endif /* _LANGUAGE_ASSEMBLY */ |
| 146 | #endif /* __ASM_GDB_STUB_H */ |