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 | |
| 15 | #undef GDBSTUB_DEBUG_PROTOCOL |
| 16 | |
| 17 | #include <asm/ptrace.h> |
| 18 | |
| 19 | /* |
| 20 | * important register numbers in GDB protocol |
| 21 | * - GR0, GR1, GR2, GR3, GR4, GR5, GR6, GR7, |
| 22 | * - GR8, GR9, GR10, GR11, GR12, GR13, GR14, GR15, |
| 23 | * - GR16, GR17, GR18, GR19, GR20, GR21, GR22, GR23, |
| 24 | * - GR24, GR25, GR26, GR27, GR28, GR29, GR30, GR31, |
| 25 | * - GR32, GR33, GR34, GR35, GR36, GR37, GR38, GR39, |
| 26 | * - GR40, GR41, GR42, GR43, GR44, GR45, GR46, GR47, |
| 27 | * - GR48, GR49, GR50, GR51, GR52, GR53, GR54, GR55, |
| 28 | * - GR56, GR57, GR58, GR59, GR60, GR61, GR62, GR63, |
| 29 | * - FR0, FR1, FR2, FR3, FR4, FR5, FR6, FR7, |
| 30 | * - FR8, FR9, FR10, FR11, FR12, FR13, FR14, FR15, |
| 31 | * - FR16, FR17, FR18, FR19, FR20, FR21, FR22, FR23, |
| 32 | * - FR24, FR25, FR26, FR27, FR28, FR29, FR30, FR31, |
| 33 | * - FR32, FR33, FR34, FR35, FR36, FR37, FR38, FR39, |
| 34 | * - FR40, FR41, FR42, FR43, FR44, FR45, FR46, FR47, |
| 35 | * - FR48, FR49, FR50, FR51, FR52, FR53, FR54, FR55, |
| 36 | * - FR56, FR57, FR58, FR59, FR60, FR61, FR62, FR63, |
| 37 | * - PC, PSR, CCR, CCCR, |
| 38 | * - _X132, _X133, _X134 |
| 39 | * - TBR, BRR, DBAR0, DBAR1, DBAR2, DBAR3, |
| 40 | * - SCR0, SCR1, SCR2, SCR3, |
| 41 | * - LR, LCR, |
| 42 | * - IACC0H, IACC0L, |
| 43 | * - FSR0, |
| 44 | * - ACC0, ACC1, ACC2, ACC3, ACC4, ACC5, ACC6, ACC7, |
| 45 | * - ACCG0123, ACCG4567, |
| 46 | * - MSR0, MSR1, |
| 47 | * - GNER0, GNER1, |
| 48 | * - FNER0, FNER1, |
| 49 | */ |
| 50 | #define GDB_REG_GR(N) (N) |
| 51 | #define GDB_REG_FR(N) (64+(N)) |
| 52 | #define GDB_REG_PC 128 |
| 53 | #define GDB_REG_PSR 129 |
| 54 | #define GDB_REG_CCR 130 |
| 55 | #define GDB_REG_CCCR 131 |
| 56 | #define GDB_REG_TBR 135 |
| 57 | #define GDB_REG_BRR 136 |
| 58 | #define GDB_REG_DBAR(N) (137+(N)) |
| 59 | #define GDB_REG_SCR(N) (141+(N)) |
| 60 | #define GDB_REG_LR 145 |
| 61 | #define GDB_REG_LCR 146 |
| 62 | #define GDB_REG_FSR0 149 |
| 63 | #define GDB_REG_ACC(N) (150+(N)) |
| 64 | #define GDB_REG_ACCG(N) (158+(N)/4) |
| 65 | #define GDB_REG_MSR(N) (160+(N)) |
| 66 | #define GDB_REG_GNER(N) (162+(N)) |
| 67 | #define GDB_REG_FNER(N) (164+(N)) |
| 68 | |
| 69 | #define GDB_REG_SP GDB_REG_GR(1) |
| 70 | #define GDB_REG_FP GDB_REG_GR(2) |
| 71 | |
| 72 | #ifndef _LANGUAGE_ASSEMBLY |
| 73 | |
| 74 | /* |
| 75 | * Prototypes |
| 76 | */ |
| 77 | extern void show_registers_only(struct pt_regs *regs); |
| 78 | |
| 79 | extern void gdbstub_init(void); |
| 80 | extern void gdbstub(int type); |
| 81 | extern void gdbstub_exit(int status); |
| 82 | |
| 83 | extern void gdbstub_io_init(void); |
| 84 | extern void gdbstub_set_baud(unsigned baud); |
| 85 | extern int gdbstub_rx_char(unsigned char *_ch, int nonblock); |
| 86 | extern void gdbstub_tx_char(unsigned char ch); |
| 87 | extern void gdbstub_tx_flush(void); |
| 88 | extern void gdbstub_do_rx(void); |
| 89 | |
| 90 | extern asmlinkage void __debug_stub_init_break(void); |
| 91 | extern asmlinkage void __break_hijack_kernel_event(void); |
David Howells | 84e8cd6 | 2006-07-10 04:44:55 -0700 | [diff] [blame] | 92 | extern asmlinkage void __break_hijack_kernel_event_breaks_here(void); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 93 | extern asmlinkage void start_kernel(void); |
| 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 | |
| 112 | #ifdef GDBSTUB_DEBUG_PROTOCOL |
| 113 | #define gdbstub_proto(FMT,...) gdbstub_printk(FMT,##__VA_ARGS__) |
| 114 | #else |
| 115 | #define gdbstub_proto(FMT,...) ({ 0; }) |
| 116 | #endif |
| 117 | |
David Howells | 84e8cd6 | 2006-07-10 04:44:55 -0700 | [diff] [blame] | 118 | /* |
| 119 | * we dedicate GR31 to keeping a pointer to the gdbstub exception frame |
| 120 | * - gr31 is destroyed on entry to the gdbstub if !MMU |
| 121 | * - gr31 is saved in scr3 on entry to the gdbstub if in !MMU |
| 122 | */ |
| 123 | register struct frv_frame0 *__debug_frame0 asm("gr31"); |
| 124 | |
| 125 | #define __debug_frame (&__debug_frame0->regs) |
| 126 | #define __debug_user_context (&__debug_frame0->uc) |
| 127 | #define __debug_regs (&__debug_frame0->debug) |
| 128 | #define __debug_reg(X) ((unsigned long *) ((unsigned long) &__debug_frame0 + (X))) |
| 129 | |
| 130 | struct frv_debug_status { |
| 131 | unsigned long bpsr; |
| 132 | unsigned long dcr; |
| 133 | unsigned long brr; |
| 134 | unsigned long nmar; |
| 135 | }; |
| 136 | |
| 137 | extern struct frv_debug_status __debug_status; |
| 138 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 139 | #endif /* _LANGUAGE_ASSEMBLY */ |
| 140 | #endif /* __ASM_GDB_STUB_H */ |