Path: blob/master/arch/mn10300/include/asm/gdb-stub.h
15126 views
/* MN10300 Kernel GDB stub definitions1*2* Copyright (C) 2007 Red Hat, Inc. All Rights Reserved.3* Written by David Howells ([email protected])4* - Derived from asm-mips/gdb-stub.h (c) 1995 Andreas Busse5*6* This program is free software; you can redistribute it and/or7* modify it under the terms of the GNU General Public Licence8* as published by the Free Software Foundation; either version9* 2 of the Licence, or (at your option) any later version.10*/11#ifndef _ASM_GDB_STUB_H12#define _ASM_GDB_STUB_H1314#include <asm/exceptions.h>1516/*17* register ID numbers in GDB remote protocol18*/1920#define GDB_REGID_PC 921#define GDB_REGID_FP 722#define GDB_REGID_SP 82324/*25* virtual stack layout for the GDB exception handler26*/27#define NUMREGS 642829#define GDB_FR_D0 (0 * 4)30#define GDB_FR_D1 (1 * 4)31#define GDB_FR_D2 (2 * 4)32#define GDB_FR_D3 (3 * 4)33#define GDB_FR_A0 (4 * 4)34#define GDB_FR_A1 (5 * 4)35#define GDB_FR_A2 (6 * 4)36#define GDB_FR_A3 (7 * 4)3738#define GDB_FR_SP (8 * 4)39#define GDB_FR_PC (9 * 4)40#define GDB_FR_MDR (10 * 4)41#define GDB_FR_EPSW (11 * 4)42#define GDB_FR_LIR (12 * 4)43#define GDB_FR_LAR (13 * 4)44#define GDB_FR_MDRQ (14 * 4)4546#define GDB_FR_E0 (15 * 4)47#define GDB_FR_E1 (16 * 4)48#define GDB_FR_E2 (17 * 4)49#define GDB_FR_E3 (18 * 4)50#define GDB_FR_E4 (19 * 4)51#define GDB_FR_E5 (20 * 4)52#define GDB_FR_E6 (21 * 4)53#define GDB_FR_E7 (22 * 4)5455#define GDB_FR_SSP (23 * 4)56#define GDB_FR_MSP (24 * 4)57#define GDB_FR_USP (25 * 4)58#define GDB_FR_MCRH (26 * 4)59#define GDB_FR_MCRL (27 * 4)60#define GDB_FR_MCVF (28 * 4)6162#define GDB_FR_FPCR (29 * 4)63#define GDB_FR_DUMMY0 (30 * 4)64#define GDB_FR_DUMMY1 (31 * 4)6566#define GDB_FR_FS0 (32 * 4)6768#define GDB_FR_SIZE (NUMREGS * 4)6970#ifndef __ASSEMBLY__7172/*73* This is the same as above, but for the high-level74* part of the GDB stub.75*/7677struct gdb_regs {78/* saved main processor registers */79u32 d0, d1, d2, d3, a0, a1, a2, a3;80u32 sp, pc, mdr, epsw, lir, lar, mdrq;81u32 e0, e1, e2, e3, e4, e5, e6, e7;82u32 ssp, msp, usp, mcrh, mcrl, mcvf;8384/* saved floating point registers */85u32 fpcr, _dummy0, _dummy1;86u32 fs0, fs1, fs2, fs3, fs4, fs5, fs6, fs7;87u32 fs8, fs9, fs10, fs11, fs12, fs13, fs14, fs15;88u32 fs16, fs17, fs18, fs19, fs20, fs21, fs22, fs23;89u32 fs24, fs25, fs26, fs27, fs28, fs29, fs30, fs31;90};9192/*93* Prototypes94*/95extern void show_registers_only(struct pt_regs *regs);9697extern asmlinkage void gdbstub_init(void);98extern asmlinkage void gdbstub_exit(int status);99extern asmlinkage void gdbstub_io_init(void);100extern asmlinkage void gdbstub_io_set_baud(unsigned baud);101extern asmlinkage int gdbstub_io_rx_char(unsigned char *_ch, int nonblock);102extern asmlinkage void gdbstub_io_tx_char(unsigned char ch);103extern asmlinkage void gdbstub_io_tx_flush(void);104105extern asmlinkage void gdbstub_io_rx_handler(void);106extern asmlinkage void gdbstub_rx_irq(struct pt_regs *, enum exception_code);107extern asmlinkage int gdbstub_intercept(struct pt_regs *, enum exception_code);108extern asmlinkage void gdbstub_exception(struct pt_regs *, enum exception_code);109extern asmlinkage void __gdbstub_bug_trap(void);110extern asmlinkage void __gdbstub_pause(void);111112#ifdef CONFIG_MN10300_CACHE_ENABLED113extern asmlinkage void gdbstub_purge_cache(void);114#else115#define gdbstub_purge_cache() do {} while (0)116#endif117118/* Used to prevent crashes in memory access */119extern asmlinkage int gdbstub_read_byte(const u8 *, u8 *);120extern asmlinkage int gdbstub_read_word(const u8 *, u8 *);121extern asmlinkage int gdbstub_read_dword(const u8 *, u8 *);122extern asmlinkage int gdbstub_write_byte(u32, u8 *);123extern asmlinkage int gdbstub_write_word(u32, u8 *);124extern asmlinkage int gdbstub_write_dword(u32, u8 *);125126extern asmlinkage void gdbstub_read_byte_guard(void);127extern asmlinkage void gdbstub_read_byte_cont(void);128extern asmlinkage void gdbstub_read_word_guard(void);129extern asmlinkage void gdbstub_read_word_cont(void);130extern asmlinkage void gdbstub_read_dword_guard(void);131extern asmlinkage void gdbstub_read_dword_cont(void);132extern asmlinkage void gdbstub_write_byte_guard(void);133extern asmlinkage void gdbstub_write_byte_cont(void);134extern asmlinkage void gdbstub_write_word_guard(void);135extern asmlinkage void gdbstub_write_word_cont(void);136extern asmlinkage void gdbstub_write_dword_guard(void);137extern asmlinkage void gdbstub_write_dword_cont(void);138139extern u8 gdbstub_rx_buffer[PAGE_SIZE];140extern u32 gdbstub_rx_inp;141extern u32 gdbstub_rx_outp;142extern u8 gdbstub_rx_overflow;143extern u8 gdbstub_busy;144extern u8 gdbstub_rx_unget;145146#ifdef CONFIG_GDBSTUB_DEBUGGING147extern void gdbstub_printk(const char *fmt, ...)148__attribute__((format(printf, 1, 2)));149#else150static inline __attribute__((format(printf, 1, 2)))151void gdbstub_printk(const char *fmt, ...)152{153}154#endif155156#ifdef CONFIG_GDBSTUB_DEBUG_ENTRY157#define gdbstub_entry(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)158#else159#define gdbstub_entry(FMT, ...) no_printk(FMT, ##__VA_ARGS__)160#endif161162#ifdef CONFIG_GDBSTUB_DEBUG_PROTOCOL163#define gdbstub_proto(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)164#else165#define gdbstub_proto(FMT, ...) no_printk(FMT, ##__VA_ARGS__)166#endif167168#ifdef CONFIG_GDBSTUB_DEBUG_IO169#define gdbstub_io(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)170#else171#define gdbstub_io(FMT, ...) no_printk(FMT, ##__VA_ARGS__)172#endif173174#ifdef CONFIG_GDBSTUB_DEBUG_BREAKPOINT175#define gdbstub_bkpt(FMT, ...) gdbstub_printk(FMT, ##__VA_ARGS__)176#else177#define gdbstub_bkpt(FMT, ...) no_printk(FMT, ##__VA_ARGS__)178#endif179180#endif /* !__ASSEMBLY__ */181#endif /* _ASM_GDB_STUB_H */182183184