]> git.kernelconcepts.de Git - karo-tx-redboot.git/blob - packages/cygmon/v2_0/misc/mips/mips-mon.c
Initial revision
[karo-tx-redboot.git] / packages / cygmon / v2_0 / misc / mips / mips-mon.c
1 //==========================================================================
2 //
3 //      mips-mon.c
4 //
5 //      Support code to extend the generic monitor code to support
6 //      MIPS processors.
7 //
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.
13 //
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.
17 //
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
21 // for more details.
22 //
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.
26 //
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.
33 //
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.
36 //
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####
43 //
44 // Author(s):    dmoseley
45 // Contributors: dmoseley
46 // Date:         2000-06-07
47 // Purpose:      Support code to extend the generic monitor code to support
48 //               MIPS(R) processors.
49 // Description:  Further board specific support is in other files.
50 //               This file contains:
51 //                 register names lookup table
52 //
53 //               Empty Stubs:
54 //                 Interval timer - This should really belong to the application
55 //                 operating system.
56 //
57 //               Should not contain:
58 //                 low level uart getchar and putchar functions
59 //                 delay function to support uart
60 //
61 //####DESCRIPTIONEND####
62 //
63 //=========================================================================
64
65 #include "monitor.h"
66
67 struct regstruct regtab[] =
68 {
69     { "zero",      REG_ZERO },
70     { "at",        REG_AT },
71     { "v0",        REG_V0 },
72     { "v1",        REG_V1 },
73     { "a0",        REG_A0 },
74     { "a1",        REG_A1 },
75     { "a2",        REG_A2 },
76     { "a3",        REG_A3 },
77     { "t0",        REG_T0 },
78     { "t1",        REG_T1 },
79     { "t2",        REG_T2 },
80     { "t3",        REG_T3 },
81     { "t4",        REG_T4 },
82     { "t5",        REG_T5 },
83     { "t6",        REG_T6 },
84     { "t7",        REG_T7 },
85     { "s0",        REG_S0 },
86     { "s1",        REG_S1 },
87     { "s2",        REG_S2 },
88     { "s3",        REG_S3 },
89     { "s4",        REG_S4 },
90     { "s5",        REG_S5 },
91     { "s6",        REG_S6 },
92     { "s7",        REG_S7 },
93     { "t8",        REG_T8 },
94     { "t9",        REG_T9 },
95     { "k0",        REG_K0 },
96     { "k1",        REG_K1 },
97     { "gp",        REG_GP },
98     { "sp",        REG_SP },
99     { "s8",        REG_S8 },
100     { "ra",        REG_RA },
101
102     { "sr",        REG_SR },
103     { "lo",        REG_LO },
104     { "hi",        REG_HI },
105     { "badvr",     REG_BAD },
106     { "cause",     REG_CAUSE },
107     { "pc",        REG_PC },
108 #ifdef CYGHWR_HAL_MIPS_FPU
109     { "f0",        REG_F0 },
110     { "f1",        REG_F1 },
111     { "f2",        REG_F2 },
112     { "f3",        REG_F3 },
113     { "f4",        REG_F4 },
114     { "f5",        REG_F5 },
115     { "f6",        REG_F6 },
116     { "f7",        REG_F7 },
117     { "f8",        REG_F8 },
118     { "f9",        REG_F9 },
119     { "f10",       REG_F10 },
120     { "f11",       REG_F11 },
121     { "f12",       REG_F12 },
122     { "f13",       REG_F13 },
123     { "f14",       REG_F14 },
124     { "f15",       REG_F15 },
125     { "f16",       REG_F16 },
126     { "f17",       REG_F17 },
127     { "f18",       REG_F18 },
128     { "f19",       REG_F19 },
129     { "f20",       REG_F20 },
130     { "f21",       REG_F21 },
131     { "f22",       REG_F22 },
132     { "f23",       REG_F23 },
133     { "f24",       REG_F24 },
134     { "f25",       REG_F25 },
135     { "f26",       REG_F26 },
136     { "f27",       REG_F27 },
137     { "f28",       REG_F28 },
138     { "f29",       REG_F29 },
139     { "f30",       REG_F30 },
140     { "f31",       REG_F31 },
141     { "fcr31",     REG_FCR31 },
142 #endif /* CYGHWR_HAL_MIPS_FPU */
143     { 0, 0 }, /* Terminating element must be last */
144 } ;
145
146 void
147 initialize_mon(void)
148 {
149 } /* initialize_mon */
150
151
152 #include <cyg/hal/hal_arch.h>
153 #include <bsp/common/bsp_if.h>
154 int
155 machine_syscall(HAL_SavedRegisters *regs)
156 {
157     int res, err;
158     target_register_t a0, a1, a2, a3;
159
160     a0 = get_register(REG_A0);
161     a1 = get_register(REG_A1);
162     a2 = get_register(REG_A2);
163     a3 = get_register(REG_A3);
164
165     err = _bsp_do_syscall(a0, // Function
166                           a1, a2, a3, 0, // arguments,
167                           &res);
168     if (err)
169     {
170         // This was a syscall.  It has now been handled, so update the registers appropriately
171         put_register(REG_V0, res);
172         bsp_skip_instruction(regs);
173     }
174
175     return err;
176 }
177
178
179 // Utility function for printing breakpoints
180 void bp_print(target_register_t bp_val)
181 {
182     bsp_printf("0x%08lx\n", (unsigned long)bp_val);
183 }