1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_COLDFIRE_STUB_H
|
2 |
|
|
#define CYGONCE_HAL_COLDFIRE_STUB_H
|
3 |
|
|
|
4 |
|
|
//========================================================================
|
5 |
|
|
//
|
6 |
|
|
// coldfire_stub.h
|
7 |
|
|
//
|
8 |
|
|
// ColdFire-specific definitions for generic stub
|
9 |
|
|
//
|
10 |
|
|
//========================================================================
|
11 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002, 2006 Free Software Foundation, Inc.
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
19 |
|
|
// version.
|
20 |
|
|
//
|
21 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
22 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
23 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
24 |
|
|
// for more details.
|
25 |
|
|
//
|
26 |
|
|
// You should have received a copy of the GNU General Public License
|
27 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
28 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
29 |
|
|
//
|
30 |
|
|
// As a special exception, if other files instantiate templates or use
|
31 |
|
|
// macros or inline functions from this file, or you compile this file
|
32 |
|
|
// and link it with other works to produce a work based on this file,
|
33 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
34 |
|
|
// the GNU General Public License. However the source code for this file
|
35 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
36 |
|
|
// General Public License v2.
|
37 |
|
|
//
|
38 |
|
|
// This exception does not invalidate any other reasons why a work based
|
39 |
|
|
// on this file might be covered by the GNU General Public License.
|
40 |
|
|
// -------------------------------------------
|
41 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
42 |
|
|
//========================================================================
|
43 |
|
|
//#####DESCRIPTIONBEGIN####
|
44 |
|
|
//
|
45 |
|
|
// Author(s): Enrico Piria
|
46 |
|
|
// Contributors:
|
47 |
|
|
// Date: 2005-25-06
|
48 |
|
|
// Purpose:
|
49 |
|
|
// Description: ColdFire-specific definitions for generic stub.
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//========================================================================
|
53 |
|
|
|
54 |
|
|
#ifdef __cplusplus
|
55 |
|
|
extern "C" {
|
56 |
|
|
#endif
|
57 |
|
|
|
58 |
|
|
#define NUMREGS 18
|
59 |
|
|
|
60 |
|
|
// ColdFire stub has special needs for register handling because flating point
|
61 |
|
|
// registers are bigger than the rest. Special put_register and get_register
|
62 |
|
|
// are provided.
|
63 |
|
|
#define CYGARC_STUB_REGISTER_ACCESS_DEFINED 1
|
64 |
|
|
|
65 |
|
|
#define REGSIZE( _x_ ) (4)
|
66 |
|
|
|
67 |
|
|
typedef unsigned long target_register_t;
|
68 |
|
|
|
69 |
|
|
enum regnames {
|
70 |
|
|
D0, D1, D2, D3, D4, D5, D6, D7,
|
71 |
|
|
A0, A1, A2, A3, A4, A5, A6, A7,
|
72 |
|
|
SR, PC,
|
73 |
|
|
};
|
74 |
|
|
|
75 |
|
|
#define SP A7
|
76 |
|
|
|
77 |
|
|
typedef enum regnames regnames_t;
|
78 |
|
|
|
79 |
|
|
// Given a trap value TRAP, return the corresponding signal
|
80 |
|
|
extern int __computeSignal(unsigned int trap_number);
|
81 |
|
|
|
82 |
|
|
// Return the ColdFire trap number corresponding to the last-taken trap
|
83 |
|
|
extern int __get_trap_number(void);
|
84 |
|
|
|
85 |
|
|
// Return the currently-saved value corresponding to register REG
|
86 |
|
|
extern target_register_t get_register(regnames_t reg);
|
87 |
|
|
|
88 |
|
|
// Store VALUE in the register corresponding to WHICH
|
89 |
|
|
extern void put_register(regnames_t which, target_register_t value);
|
90 |
|
|
|
91 |
|
|
// Read the contents of register WHICH into VALUE as raw bytes
|
92 |
|
|
extern int get_register_as_bytes(regnames_t which, char *value);
|
93 |
|
|
|
94 |
|
|
// Write the contents of register WHICH into VALUE as raw bytes
|
95 |
|
|
extern int put_register_as_bytes(regnames_t which, char *value);
|
96 |
|
|
|
97 |
|
|
// Set the currently-saved pc register value to PC. This also updates NPC
|
98 |
|
|
// as needed.
|
99 |
|
|
extern void set_pc(target_register_t pc);
|
100 |
|
|
|
101 |
|
|
// Set things up so that the next user resume will execute one instruction.
|
102 |
|
|
// This may be done by setting breakpoints or setting a single step flag
|
103 |
|
|
// in the saved user registers, for example.
|
104 |
|
|
extern void __single_step(void);
|
105 |
|
|
|
106 |
|
|
// Clear the single-step state
|
107 |
|
|
extern void __clear_single_step(void);
|
108 |
|
|
|
109 |
|
|
// If the breakpoint we hit is in the breakpoint() instruction, return a
|
110 |
|
|
// non-zero value
|
111 |
|
|
extern int __is_breakpoint_function(void);
|
112 |
|
|
|
113 |
|
|
// Skip the current instruction
|
114 |
|
|
extern void __skipinst(void);
|
115 |
|
|
|
116 |
|
|
extern void __install_breakpoints(void);
|
117 |
|
|
|
118 |
|
|
extern void __clear_breakpoints(void);
|
119 |
|
|
|
120 |
|
|
// We have to rewind the PC in case of a breakpoint.
|
121 |
|
|
#define HAL_STUB_PLATFORM_STUBS_FIXUP() \
|
122 |
|
|
CYG_MACRO_START \
|
123 |
|
|
if (CYGNUM_HAL_VECTOR_DEBUGTRAP == __get_trap_number()) \
|
124 |
|
|
{ \
|
125 |
|
|
CYG_ADDRESS pc = get_register(PC) - HAL_BREAKINST_SIZE; \
|
126 |
|
|
put_register(PC, pc); \
|
127 |
|
|
} \
|
128 |
|
|
CYG_MACRO_END
|
129 |
|
|
|
130 |
|
|
#ifdef __cplusplus
|
131 |
|
|
} // extern "C"
|
132 |
|
|
#endif
|
133 |
|
|
|
134 |
|
|
// ---------------------------------------------------------------------------
|
135 |
|
|
// End of coldfire_stub.h
|
136 |
|
|
#endif // ifndef CYGONCE_HAL_COLDFIRE_STUB_H
|