1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_PPC_STUB_H
|
2 |
|
|
#define CYGONCE_HAL_PPC_STUB_H
|
3 |
|
|
//========================================================================
|
4 |
|
|
//
|
5 |
|
|
// ppc_stub.h
|
6 |
|
|
//
|
7 |
|
|
// PowerPC-specific definitions for generic stub
|
8 |
|
|
//
|
9 |
|
|
//========================================================================
|
10 |
|
|
// ####ECOSGPLCOPYRIGHTBEGIN####
|
11 |
|
|
// -------------------------------------------
|
12 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
13 |
|
|
// Copyright (C) 1998, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
|
14 |
|
|
//
|
15 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
16 |
|
|
// the terms of the GNU General Public License as published by the Free
|
17 |
|
|
// Software Foundation; either version 2 or (at your option) any later
|
18 |
|
|
// version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT
|
21 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License
|
26 |
|
|
// along with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use
|
30 |
|
|
// macros or inline functions from this file, or you compile this file
|
31 |
|
|
// and link it with other works to produce a work based on this file,
|
32 |
|
|
// this file does not by itself cause the resulting work to be covered by
|
33 |
|
|
// the GNU General Public License. However the source code for this file
|
34 |
|
|
// must still be made available in accordance with section (3) of the GNU
|
35 |
|
|
// General Public License v2.
|
36 |
|
|
//
|
37 |
|
|
// This exception does not invalidate any other reasons why a work based
|
38 |
|
|
// on this file might be covered by the GNU General Public License.
|
39 |
|
|
// -------------------------------------------
|
40 |
|
|
// ####ECOSGPLCOPYRIGHTEND####
|
41 |
|
|
//========================================================================
|
42 |
|
|
//#####DESCRIPTIONBEGIN####
|
43 |
|
|
//
|
44 |
|
|
// Author(s): Red Hat, jskov
|
45 |
|
|
// Contributors: Red Hat, jskov
|
46 |
|
|
// Date: 1998-08-20
|
47 |
|
|
// Purpose:
|
48 |
|
|
// Description: PowerPC-specific definitions for generic stub
|
49 |
|
|
// Usage:
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//
|
53 |
|
|
//========================================================================
|
54 |
|
|
|
55 |
|
|
#ifdef __cplusplus
|
56 |
|
|
extern "C" {
|
57 |
|
|
#endif
|
58 |
|
|
|
59 |
|
|
typedef unsigned long target_register_t;
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
#ifndef CYGHWR_HAL_POWERPC_BOOK_E
|
63 |
|
|
|
64 |
|
|
// Most PowerPCs use a standard register layout.
|
65 |
|
|
|
66 |
|
|
#define NUMREGS 71
|
67 |
|
|
|
68 |
|
|
#define REGSIZE( _x_ ) (((_x_) >= F0 && (_x_) <= F31) ? 8 : 4)
|
69 |
|
|
|
70 |
|
|
#else
|
71 |
|
|
|
72 |
|
|
// BookE processors only have 70 registers, MQ is not supported. All
|
73 |
|
|
// registers are 32 bit and instead of FP registers there are the top
|
74 |
|
|
// 32 bits of the GPRs. The 64-bit registers are only used by SPE
|
75 |
|
|
// instructions, which we don't currently support.
|
76 |
|
|
|
77 |
|
|
#define NUMREGS 70
|
78 |
|
|
|
79 |
|
|
#define REGSIZE( _x_ ) (4)
|
80 |
|
|
|
81 |
|
|
#endif
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
#ifdef CYGHWR_HAL_POWERPC_FPU
|
85 |
|
|
// The PowerPC has floating point registers that are larger than what it
|
86 |
|
|
// can hold in a target_register_t
|
87 |
|
|
#define TARGET_HAS_LARGE_REGISTERS
|
88 |
|
|
|
89 |
|
|
// PowerPC stub has special needs for register handling because flating point
|
90 |
|
|
// registers are bigger than the rest. Special put_register and get_register
|
91 |
|
|
// are provided
|
92 |
|
|
#define CYGARC_STUB_REGISTER_ACCESS_DEFINED 1
|
93 |
|
|
|
94 |
|
|
// extra space needed for floating point registers
|
95 |
|
|
#define HAL_STUB_REGISTERS_SIZE ((sizeof(GDB_Registers) + sizeof(target_register_t) - 1)/sizeof(target_register_t))
|
96 |
|
|
#endif
|
97 |
|
|
|
98 |
|
|
|
99 |
|
|
enum regnames {
|
100 |
|
|
R0, R1, R2, R3, R4, R5, R6, R7,
|
101 |
|
|
R8, R9, R10, R11, R12, R13, R14, R15,
|
102 |
|
|
R16, R17, R18, R19, R20, R21, R22, R23,
|
103 |
|
|
R24, R25, R26, R27, R28, R29, R30, R31,
|
104 |
|
|
F0, F1, F2, F3, F4, F5, F6, F7,
|
105 |
|
|
F8, F9, F10, F11, F12, F13, F14, F15,
|
106 |
|
|
F16, F17, F18, F19, F20, F21, F22, F23,
|
107 |
|
|
F24, F25, F26, F27, F28, F29, F30, F31,
|
108 |
|
|
PC, PS, CND, LR, CNT, XER, MQ
|
109 |
|
|
};
|
110 |
|
|
|
111 |
|
|
// For convenience
|
112 |
|
|
#define SP R1
|
113 |
|
|
|
114 |
|
|
typedef enum regnames regnames_t;
|
115 |
|
|
|
116 |
|
|
/* Given a trap value TRAP, return the corresponding signal. */
|
117 |
|
|
extern int __computeSignal (unsigned int trap_number);
|
118 |
|
|
|
119 |
|
|
/* Return the SPARC trap number corresponding to the last-taken trap. */
|
120 |
|
|
extern int __get_trap_number (void);
|
121 |
|
|
|
122 |
|
|
/* Return the currently-saved value corresponding to register REG. */
|
123 |
|
|
extern target_register_t get_register (regnames_t reg);
|
124 |
|
|
|
125 |
|
|
/* Store VALUE in the register corresponding to WHICH. */
|
126 |
|
|
extern void put_register (regnames_t which, target_register_t value);
|
127 |
|
|
|
128 |
|
|
/* Set the currently-saved pc register value to PC. This also updates NPC
|
129 |
|
|
as needed. */
|
130 |
|
|
extern void set_pc (target_register_t pc);
|
131 |
|
|
|
132 |
|
|
/* Set things up so that the next user resume will execute one instruction.
|
133 |
|
|
This may be done by setting breakpoints or setting a single step flag
|
134 |
|
|
in the saved user registers, for example. */
|
135 |
|
|
void __single_step (void);
|
136 |
|
|
|
137 |
|
|
/* Clear the single-step state. */
|
138 |
|
|
void __clear_single_step (void);
|
139 |
|
|
|
140 |
|
|
/* If the breakpoint we hit is in the breakpoint() instruction, return a
|
141 |
|
|
non-zero value. */
|
142 |
|
|
extern int __is_breakpoint_function (void);
|
143 |
|
|
|
144 |
|
|
/* Skip the current instruction. */
|
145 |
|
|
extern void __skipinst (void);
|
146 |
|
|
|
147 |
|
|
extern void __install_breakpoints (void);
|
148 |
|
|
|
149 |
|
|
extern void __clear_breakpoints (void);
|
150 |
|
|
|
151 |
|
|
#ifdef __cplusplus
|
152 |
|
|
} /* extern "C" */
|
153 |
|
|
#endif
|
154 |
|
|
|
155 |
|
|
#endif // ifndef CYGONCE_HAL_PPC_STUB_H
|