1 |
786 |
skrzyp |
#ifndef CYGONCE_HAL_MIPS_STUB_H
|
2 |
|
|
#define CYGONCE_HAL_MIPS_STUB_H
|
3 |
|
|
//========================================================================
|
4 |
|
|
//
|
5 |
|
|
// mips-stub.h
|
6 |
|
|
//
|
7 |
|
|
// CalmRISC16-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, msalter
|
45 |
|
|
// Contributors: Red Hat, msalter
|
46 |
|
|
// Date: 2001-02-12
|
47 |
|
|
// Purpose:
|
48 |
|
|
// Description: CalmRISC16-specific definitions for generic stub
|
49 |
|
|
// Usage:
|
50 |
|
|
//
|
51 |
|
|
//####DESCRIPTIONEND####
|
52 |
|
|
//
|
53 |
|
|
//========================================================================
|
54 |
|
|
|
55 |
|
|
|
56 |
|
|
#include <pkgconf/system.h>
|
57 |
|
|
|
58 |
|
|
#include <cyg/hal/hal_io.h>
|
59 |
|
|
|
60 |
|
|
#ifdef __cplusplus
|
61 |
|
|
extern "C" {
|
62 |
|
|
#endif
|
63 |
|
|
|
64 |
|
|
#define TARGET_HAS_HARVARD_MEMORY 1
|
65 |
|
|
typedef unsigned long target_addr_t;
|
66 |
|
|
#define TARGET_ADDR_IS_PROGMEM(x) (((unsigned long)(x)) >= 0x400000UL)
|
67 |
|
|
#define TARGET_ADDR_TO_PTR(x) ((char *) (((unsigned long)(x)) & 0x3fffff))
|
68 |
|
|
|
69 |
|
|
#define NUMREGS 39
|
70 |
|
|
|
71 |
|
|
typedef unsigned long target_register_t;
|
72 |
|
|
|
73 |
|
|
enum regnames {
|
74 |
|
|
REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
|
75 |
|
|
REG_R8, REG_R9, REG_R10, REG_R11, REG_R12, REG_R13, REG_R14, REG_R15,
|
76 |
|
|
REG_E8, REG_E9, REG_E10, REG_E11, REG_E12, REG_E13, REG_E14, REG_E15,
|
77 |
|
|
REG_A8, REG_A9, REG_A10, REG_A11, REG_A12, REG_A13, REG_A14, REG_A15,
|
78 |
|
|
REG_PC, REG_SPC_FIQ, REG_SPC_IRQ,
|
79 |
|
|
REG_SR, REG_SSR_FIQ, REG_SSR_IRQ, REG_SSR_SWI
|
80 |
|
|
};
|
81 |
|
|
|
82 |
|
|
#define REG_LR REG_A14
|
83 |
|
|
#define REG_SP REG_A15
|
84 |
|
|
|
85 |
|
|
#define PC REG_PC
|
86 |
|
|
#define SP REG_A15
|
87 |
|
|
|
88 |
|
|
#define REGSIZE(X) 4
|
89 |
|
|
#define REGBYTE(X) ((X)*4)
|
90 |
|
|
|
91 |
|
|
typedef enum regnames regnames_t;
|
92 |
|
|
|
93 |
|
|
/* Given a trap value TRAP, return the corresponding signal. */
|
94 |
|
|
extern int __computeSignal (unsigned int trap_number);
|
95 |
|
|
|
96 |
|
|
/* Return the SPARC trap number corresponding to the last-taken trap. */
|
97 |
|
|
extern int __get_trap_number (void);
|
98 |
|
|
|
99 |
|
|
/* Return the currently-saved value corresponding to register REG. */
|
100 |
|
|
extern target_register_t get_register (regnames_t reg);
|
101 |
|
|
|
102 |
|
|
/* Store VALUE in the register corresponding to WHICH. */
|
103 |
|
|
extern void put_register (regnames_t which, target_register_t value);
|
104 |
|
|
|
105 |
|
|
/* Set the currently-saved pc register value to PC. This also updates NPC
|
106 |
|
|
as needed. */
|
107 |
|
|
#if !defined(SET_PC_PROTOTYPE_EXISTS) && !defined(set_pc)
|
108 |
|
|
#define SET_PC_PROTOTYPE_EXISTS
|
109 |
|
|
extern void set_pc (target_register_t pc);
|
110 |
|
|
#endif
|
111 |
|
|
|
112 |
|
|
/* Set things up so that the next user resume will execute one instruction.
|
113 |
|
|
This may be done by setting breakpoints or setting a single step flag
|
114 |
|
|
in the saved user registers, for example. */
|
115 |
|
|
#ifndef __single_step
|
116 |
|
|
void __single_step (void);
|
117 |
|
|
#endif
|
118 |
|
|
|
119 |
|
|
/* Clear the single-step state. */
|
120 |
|
|
void __clear_single_step (void);
|
121 |
|
|
|
122 |
|
|
extern int __is_bsp_syscall(void);
|
123 |
|
|
|
124 |
|
|
extern int hal_syscall_handler(void);
|
125 |
|
|
|
126 |
|
|
/* If the breakpoint we hit is in the breakpoint() instruction, return a
|
127 |
|
|
non-zero value. */
|
128 |
|
|
#ifndef __is_breakpoint_function
|
129 |
|
|
extern int __is_breakpoint_function (void);
|
130 |
|
|
#endif
|
131 |
|
|
|
132 |
|
|
/* Skip the current instruction. */
|
133 |
|
|
extern void __skipinst (void);
|
134 |
|
|
|
135 |
|
|
extern void __install_breakpoints (void);
|
136 |
|
|
|
137 |
|
|
extern void __clear_breakpoints (void);
|
138 |
|
|
|
139 |
|
|
extern void __install_breakpoint_list (void);
|
140 |
|
|
|
141 |
|
|
extern void __clear_breakpoint_list (void);
|
142 |
|
|
|
143 |
|
|
extern unsigned char __read_prog_uint8(void *addr);
|
144 |
|
|
extern unsigned short __read_prog_uint16(void *addr);
|
145 |
|
|
extern unsigned long __read_prog_uint32(void *addr);
|
146 |
|
|
|
147 |
|
|
extern void __write_prog_uint8(void *addr, unsigned char val);
|
148 |
|
|
extern void __write_prog_uint16(void *addr, unsigned short val);
|
149 |
|
|
extern void __write_prog_uint32(void *addr, unsigned long val);
|
150 |
|
|
|
151 |
|
|
#ifdef __cplusplus
|
152 |
|
|
} /* extern "C" */
|
153 |
|
|
#endif
|
154 |
|
|
|
155 |
|
|
#endif // ifndef CYGONCE_HAL_MIPS_STUB_H
|