| 1 |
27 |
unneback |
//========================================================================
|
| 2 |
|
|
//
|
| 3 |
|
|
// openrisc_stub.h
|
| 4 |
|
|
//
|
| 5 |
|
|
// OpenRISC-specific definitions for remote debugging via gdb
|
| 6 |
|
|
//
|
| 7 |
|
|
//========================================================================
|
| 8 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
| 9 |
|
|
// -------------------------------------------
|
| 10 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
| 11 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
|
| 12 |
|
|
//
|
| 13 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
| 14 |
|
|
// the terms of the GNU General Public License as published by the Free
|
| 15 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
| 16 |
|
|
//
|
| 17 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
| 18 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
| 19 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
| 20 |
|
|
// for more details.
|
| 21 |
|
|
//
|
| 22 |
|
|
// You should have received a copy of the GNU General Public License along
|
| 23 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
| 24 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
| 25 |
|
|
//
|
| 26 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
| 27 |
|
|
// or inline functions from this file, or you compile this file and link it
|
| 28 |
|
|
// with other works to produce a work based on this file, this file does not
|
| 29 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
| 30 |
|
|
// License. However the source code for this file must still be made available
|
| 31 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
| 32 |
|
|
//
|
| 33 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
| 34 |
|
|
// this file might be covered by the GNU General Public License.
|
| 35 |
|
|
//
|
| 36 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
| 37 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
| 38 |
|
|
// -------------------------------------------
|
| 39 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
| 40 |
|
|
//========================================================================
|
| 41 |
|
|
//#####DESCRIPTIONBEGIN####
|
| 42 |
|
|
//
|
| 43 |
|
|
// Author(s): sfurman
|
| 44 |
|
|
// Contributors:Red Hat, nickg, dmoseley
|
| 45 |
|
|
// Date: 2003-02-18
|
| 46 |
|
|
// Purpose: OpenRISC-specific definitions for gdb stubs support
|
| 47 |
|
|
//
|
| 48 |
|
|
//
|
| 49 |
|
|
//####DESCRIPTIONEND####
|
| 50 |
|
|
//
|
| 51 |
|
|
//=============================================================================
|
| 52 |
|
|
|
| 53 |
|
|
#ifndef CYGONCE_HAL_OPENRISC_STUB_H
|
| 54 |
|
|
#define CYGONCE_HAL_OPENRISC_STUB_H
|
| 55 |
|
|
|
| 56 |
|
|
#include <pkgconf/system.h>
|
| 57 |
|
|
#include <pkgconf/hal.h>
|
| 58 |
|
|
|
| 59 |
|
|
#ifdef CYGPKG_IO_SERIAL
|
| 60 |
|
|
#include <pkgconf/io_serial.h>
|
| 61 |
|
|
#endif
|
| 62 |
|
|
|
| 63 |
|
|
#include <cyg/hal/hal_diag.h>
|
| 64 |
|
|
|
| 65 |
|
|
#ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
|
| 66 |
|
|
|
| 67 |
|
|
#include <cyg/infra/cyg_type.h> // CYG_UNUSED_PARAM, externC
|
| 68 |
|
|
|
| 69 |
|
|
#define HAL_STUB_PLATFORM_INIT_SERIAL() HAL_DIAG_INIT()
|
| 70 |
|
|
|
| 71 |
|
|
#define HAL_STUB_PLATFORM_GET_CHAR() \
|
| 72 |
|
|
((cyg_int8)({ \
|
| 73 |
|
|
cyg_int8 _ch_; \
|
| 74 |
|
|
HAL_DIAG_READ_CHAR(_ch_); \
|
| 75 |
|
|
_ch_; \
|
| 76 |
|
|
}))
|
| 77 |
|
|
|
| 78 |
|
|
#define HAL_STUB_PLATFORM_PUT_CHAR(c) HAL_DIAG_WRITE_CHAR((c))
|
| 79 |
|
|
|
| 80 |
|
|
#define HAL_STUB_PLATFORM_SET_BAUD_RATE(baud) CYG_UNUSED_PARAM(int,(baud))
|
| 81 |
|
|
|
| 82 |
|
|
#define HAL_STUB_PLATFORM_RESET() HAL_DIAG_INIT()
|
| 83 |
|
|
|
| 84 |
|
|
#define HAL_STUB_PLATFORM_INIT() HAL_DIAG_INIT()
|
| 85 |
|
|
|
| 86 |
|
|
#endif // ifdef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
|
| 87 |
|
|
|
| 88 |
|
|
// 32 GPRs + 32 VFRs + PC reg + SR reg
|
| 89 |
|
|
#define NUMREGS 66
|
| 90 |
|
|
|
| 91 |
|
|
// VFR regs are unimplemented so they are 0 bytes in length
|
| 92 |
|
|
#define REGSIZE( _x_ ) ((((_x_) <= R31) || ((_x_) > VFR31)) ? 4 : 0)
|
| 93 |
|
|
|
| 94 |
|
|
typedef unsigned long target_register_t;
|
| 95 |
|
|
|
| 96 |
|
|
enum regnames {
|
| 97 |
|
|
R0, SP, R2, R3, R4, R5, R6, R7,
|
| 98 |
|
|
R8, R9, R10, R11, R12, R13, R14, R15,
|
| 99 |
|
|
R16, R17, R18, R19, R20, R21, R22, R23,
|
| 100 |
|
|
R24, R25, R26, R27, R28, R29, R30, R31,
|
| 101 |
|
|
|
| 102 |
|
|
|
| 103 |
|
|
// Vector/Float registers, which are as yet unimplemented,
|
| 104 |
|
|
// but defined in the or32 gdb back-end.
|
| 105 |
|
|
|
| 106 |
|
|
VFR0, VFR1, VFR2, VFR3, VFR4, VFR5, VFR6, VFR7,
|
| 107 |
|
|
VFR8, VFR9, VFR10, VFR11, VFR12, VFR13, VFR14, VFR15,
|
| 108 |
|
|
VFR16, VFR17, VFR18, VFR19, VFR20, VFR21, VFR22, VFR23,
|
| 109 |
|
|
VFR24, VFR25, VFR26, VFR27, VFR28, VFR29, VFR30, VFR31,
|
| 110 |
|
|
|
| 111 |
|
|
// Special-purpose registers
|
| 112 |
|
|
PC, SR
|
| 113 |
|
|
};
|
| 114 |
|
|
|
| 115 |
|
|
typedef enum regnames regnames_t;
|
| 116 |
|
|
|
| 117 |
|
|
// Override generic stubs get_register() and use arch-specific version
|
| 118 |
|
|
#define CYGARC_STUB_REGISTER_ACCESS_DEFINED
|
| 119 |
|
|
|
| 120 |
|
|
#if defined(CYGDBG_HAL_DEBUG_GDB_CTRLC_SUPPORT) || defined(CYGDBG_HAL_DEBUG_GDB_BREAK_SUPPORT)
|
| 121 |
|
|
#define HAL_GET_PROFILE_INFO( _thepc_, _thesp_ ) \
|
| 122 |
|
|
CYG_MACRO_START \
|
| 123 |
|
|
extern HAL_SavedRegisters *hal_saved_interrupt_state; \
|
| 124 |
|
|
if ( hal_saved_interrupt_state ) { \
|
| 125 |
|
|
(_thepc_) = (char *)(hal_saved_interrupt_state->pc); \
|
| 126 |
|
|
(_thesp_) = (char *)(hal_saved_interrupt_state->sp); \
|
| 127 |
|
|
} \
|
| 128 |
|
|
CYG_MACRO_END
|
| 129 |
|
|
#endif
|
| 130 |
|
|
|
| 131 |
|
|
/* Given a trap value TRAP, return the corresponding signal. */
|
| 132 |
|
|
externC int __computeSignal (unsigned int trap_number);
|
| 133 |
|
|
|
| 134 |
|
|
/* Return the trap number corresponding to the last-taken trap. */
|
| 135 |
|
|
externC int __get_trap_number (void);
|
| 136 |
|
|
|
| 137 |
|
|
/* Return the currently-saved value corresponding to register REG. */
|
| 138 |
|
|
externC target_register_t get_register (regnames_t reg);
|
| 139 |
|
|
|
| 140 |
|
|
/* Store VALUE in the register corresponding to WHICH. */
|
| 141 |
|
|
externC void put_register (regnames_t which, target_register_t value);
|
| 142 |
|
|
|
| 143 |
|
|
/* Set the currently-saved pc register value to PC. This also updates NPC
|
| 144 |
|
|
as needed. */
|
| 145 |
|
|
externC void set_pc (target_register_t pc);
|
| 146 |
|
|
|
| 147 |
|
|
/* Set things up so that the next user resume will execute one instruction.
|
| 148 |
|
|
This may be done by setting breakpoints or setting a single step flag
|
| 149 |
|
|
in the saved user registers, for example. */
|
| 150 |
|
|
externC void __single_step (void);
|
| 151 |
|
|
|
| 152 |
|
|
/* Clear the single-step state. */
|
| 153 |
|
|
externC void __clear_single_step (void);
|
| 154 |
|
|
|
| 155 |
|
|
/* If the breakpoint we hit is in the breakpoint() instruction, return a
|
| 156 |
|
|
non-zero value. */
|
| 157 |
|
|
externC int __is_breakpoint_function (void);
|
| 158 |
|
|
|
| 159 |
|
|
/* Skip the current instruction. */
|
| 160 |
|
|
externC void __skipinst (void);
|
| 161 |
|
|
|
| 162 |
|
|
externC void __install_breakpoints (void);
|
| 163 |
|
|
|
| 164 |
|
|
externC void __clear_breakpoints (void);
|
| 165 |
|
|
|
| 166 |
|
|
#endif // ifndef CYGONCE_HAL_OPENRISC_STUB_H
|