1 //==========================================================================
5 // Support code to extend the generic monitor code to support
8 //==========================================================================
9 //####ECOSGPLCOPYRIGHTBEGIN####
10 // -------------------------------------------
11 // This file is part of eCos, the Embedded Configurable Operating System.
12 // Copyright (C) 1998, 1999, 2000, 2001, 2002 Red Hat, Inc.
14 // eCos is free software; you can redistribute it and/or modify it under
15 // the terms of the GNU General Public License as published by the Free
16 // Software Foundation; either version 2 or (at your option) any later version.
18 // eCos is distributed in the hope that it will be useful, but WITHOUT ANY
19 // WARRANTY; without even the implied warranty of MERCHANTABILITY or
20 // FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
23 // You should have received a copy of the GNU General Public License along
24 // with eCos; if not, write to the Free Software Foundation, Inc.,
25 // 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
27 // As a special exception, if other files instantiate templates or use macros
28 // or inline functions from this file, or you compile this file and link it
29 // with other works to produce a work based on this file, this file does not
30 // by itself cause the resulting work to be covered by the GNU General Public
31 // License. However the source code for this file must still be made available
32 // in accordance with section (3) of the GNU General Public License.
34 // This exception does not invalidate any other reasons why a work based on
35 // this file might be covered by the GNU General Public License.
37 // Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
38 // at http://sources.redhat.com/ecos/ecos-license/
39 // -------------------------------------------
40 //####ECOSGPLCOPYRIGHTEND####
41 //==========================================================================
42 //#####DESCRIPTIONBEGIN####
45 // Contributors: gthomas
47 // Purpose: Support code to extend the generic monitor code to support
49 // Description: Further board specific support is in other files.
50 // This file contains:
51 // register names lookup table
54 // Interval timer - This should really belong to the application
57 // Should not contain:
58 // low level uart getchar and putchar functions
59 // delay function to support uart
61 // ARM is a Registered Trademark of Advanced RISC Machines
63 // Other Brands and Trademarks are the property of their
66 //####DESCRIPTIONEND####
68 //=========================================================================
80 /* This module is required to provide many of the services defined
83 static char *apcs_names[] = {
84 "a1", "a2", "a3", "a4",
85 "v1", "v2", "v3", "v4",
86 "v5", "v6", "sl", "fp",
87 "ip", "sp", "lr", "pc",
89 "f0", "f1", "f2", "f3",
90 "f4", "f5", "f6", "f7",
96 static char *standard_names[] =
98 "r0", "r1", "r2", "r3",
99 "r4", "r5", "r6", "r7",
100 "r8", "r9", "r10", "r11",
101 "r12", "r13", "r14", "pc",
103 "f0", "f1", "f2", "f3",
104 "f4", "f5", "f6", "f7",
111 void arm_othernames (void);
113 struct regstruct regtab[] =
115 { 0, REG_R0, REGTYPE_INT },
116 { 0, REG_R1, REGTYPE_INT },
117 { 0, REG_R2, REGTYPE_INT },
118 { 0, REG_R3, REGTYPE_INT },
119 { 0, REG_R4, REGTYPE_INT },
120 { 0, REG_R5, REGTYPE_INT },
121 { 0, REG_R6, REGTYPE_INT },
122 { 0, REG_R7, REGTYPE_INT },
123 { 0, REG_R8, REGTYPE_INT },
124 { 0, REG_R9, REGTYPE_INT },
125 { 0, REG_R10, REGTYPE_INT },
126 { 0, REG_R11, REGTYPE_INT },
127 { 0, REG_R12, REGTYPE_INT },
128 { 0, REG_SP, REGTYPE_INT },
129 { 0, REG_LR, REGTYPE_INT },
130 { 0, REG_PC, REGTYPE_INT },
132 { 0, REG_F0, REGTYPE_FLOAT },
133 { 0, REG_F1, REGTYPE_FLOAT },
134 { 0, REG_F2, REGTYPE_FLOAT },
135 { 0, REG_F3, REGTYPE_FLOAT },
136 { 0, REG_F4, REGTYPE_FLOAT },
137 { 0, REG_F5, REGTYPE_FLOAT },
138 { 0, REG_F6, REGTYPE_FLOAT },
139 { 0, REG_F6, REGTYPE_FLOAT },
140 { 0, REG_FPS, REGTYPE_FLOAT },
142 { 0, REG_CPSR, REGTYPE_INT },
143 { 0, 0, 0 } /* Terminating element must be last */
149 /* FIXME: Convert ALL variable initializations to assignments
150 in order to support ROMABLE CODE.
151 This includes the register table
155 * Call arm_othernames to sync up Cygmon and the disassembler
156 * and ensure they are using the same set of registernames
161 * Call arm_othernames again to revert to the assembler
166 } /* initialize_mon */
172 Defaults to generic_mem.c
178 Defaults to generic_bp32.c
182 #ifndef CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
184 /* Return the currently-saved value corresponding to register "regnum". */
186 get_register (int regnum)
191 char *dest = (char*)0;
193 for (p = regtab; p->registername && p->registernumber != regnum; ++p)
196 if (p->registername) {
197 len = bsp_regsize(p->registernumber);
198 offset = bsp_regbyte(p->registernumber);
199 switch (p->registertype) {
201 dest = (char*)&(reg.i);
205 dest = (char*)&(reg.f);
210 dest = (char*)&(reg.d);
215 memcpy(dest, (char *)mon_saved_regs + offset, len);
224 /* Store VALUE in the register corresponding to REGNUM. */
226 put_register (int regnum, target_regval_t value)
230 len = bsp_regsize(regnum);
231 offset = bsp_regbyte(regnum);
232 memcpy((char *)mon_saved_regs + offset, &value, len);
235 #endif // !CYGDBG_HAL_DEBUG_GDB_INCLUDE_STUBS
237 /* Change to the alternate register set names */
239 arm_othernames (void)
241 static int regset = 1;
246 /* Change the disassembler */
247 regset = arm_toggle_regnames();
249 regset = (regset == 0) ? 1 : 0;
254 /* Disassembler is using apcs names. */
257 /* Disassembler is using standard names. */
258 name = standard_names;
260 for (i = 0; i < (sizeof(apcs_names)/sizeof(apcs_names[0])); i++)
261 regtab[i].registername = name[i];
266 #include <pkgconf/hal.h>
267 #include <cyg/hal/hal_arch.h>
268 #include "bsp/common/bsp_if.h"
271 machine_syscall(HAL_SavedRegisters *regs)
274 err = _bsp_do_syscall(regs->d[0], // Function
275 regs->d[1], regs->d[2], regs->d[3], 0, // arguments,
278 regs->pc += 4; // Advance PC