|
0
|
1 /* mips-stub.h - MIPS-specific definitions for generic stub |
|
|
2 * |
|
|
3 * Copyright (c) 1998 Cygnus Support |
|
|
4 * |
|
|
5 * The authors hereby grant permission to use, copy, modify, distribute, |
|
|
6 * and license this software and its documentation for any purpose, provided |
|
|
7 * that existing copyright notices are retained in all copies and that this |
|
|
8 * notice is included verbatim in any distributions. No written agreement, |
|
|
9 * license, or royalty fee is required for any of the authorized uses. |
|
|
10 * Modifications to this software may be copyrighted by their authors |
|
|
11 * and need not follow the licensing terms described here, provided that |
|
|
12 * the new terms are clearly indicated on the first page of each file where |
|
|
13 * they apply. |
|
|
14 */ |
|
|
15 |
|
|
16 #define NUMREGS 90 |
|
|
17 |
|
|
18 #ifdef __mips64 |
|
|
19 #define REGSIZE(X) 8 |
|
|
20 typedef unsigned long long target_register_t; |
|
|
21 #else |
|
|
22 #define REGSIZE(X) 4 |
|
|
23 typedef unsigned long target_register_t; |
|
|
24 #endif |
|
|
25 |
|
|
26 enum regnames { |
|
|
27 ZERO, AT, V0, V1, A0, A1, A2, A3, |
|
|
28 T0, T1, T2, T3, T4, T5, T6, T7, |
|
|
29 S0, S1, S2, S3, S4, S5, S6, S7, |
|
|
30 T8, T9, K0, K1, GP, SP, S8, RA, |
|
|
31 SR, LO, HI, BAD, CAUSE, PC, |
|
|
32 CONFIG = 84, CACHE, DEBUG, DEPC, EPC |
|
|
33 }; |
|
|
34 |
|
|
35 typedef enum regnames regnames_t; |
|
|
36 |
|
|
37 #include <cyg/hal/generic-stub.h> |
|
|
38 |
|
|
39 /* If ENABLED is non-zero, supply a memory fault handler that traps |
|
|
40 subsequent memory errors and sets _mem_err to 1. Otherwise, memory |
|
|
41 faults are processed as exceptions. */ |
|
|
42 extern void __set_mem_fault_trap (int enable); |
|
|
43 |
|
|
44 /* Write C to the current serial port. */ |
|
|
45 extern void putDebugChar (int c); |
|
|
46 |
|
|
47 /* Read one character from the current serial port. */ |
|
|
48 extern int getDebugChar (void); |
|
|
49 |
|
|
50 /* Given a trap value TRAP, return the corresponding signal. */ |
|
|
51 extern int __computeSignal (unsigned int trap_number); |
|
|
52 |
|
|
53 /* Install the standard set of trap handlers for the stub. */ |
|
|
54 extern void __install_traps (void); |
|
|
55 |
|
|
56 /* Return the SPARC trap number corresponding to the last-taken trap. */ |
|
|
57 extern int __get_trap_number (void); |
|
|
58 |
|
|
59 /* Return the currently-saved value corresponding to register REG. */ |
|
|
60 extern target_register_t get_register (regnames_t reg); |
|
|
61 |
|
|
62 /* Store VALUE in the register corresponding to WHICH. */ |
|
|
63 extern void put_register (regnames_t which, target_register_t value); |
|
|
64 |
|
|
65 /* Set the currently-saved pc register value to PC. This also updates NPC |
|
|
66 as needed. */ |
|
|
67 extern void set_pc (target_register_t pc); |
|
|
68 |
|
|
69 /* Flush the instruction cache. */ |
|
|
70 extern void flush_i_cache (void); |
|
|
71 |
|
|
72 /* Reset the board. */ |
|
|
73 extern void __reset (void); |
|
|
74 |
|
|
75 /* Set the baud rate for the current serial port. */ |
|
|
76 extern void __set_baud_rate (int baud); |
|
|
77 |
|
|
78 /* Initialize the hardware. */ |
|
|
79 extern void initHardware (void); |
|
|
80 |
|
|
81 /* Set things up so that the next user resume will execute one instruction. |
|
|
82 This may be done by setting breakpoints or setting a single step flag |
|
|
83 in the saved user registers, for example. */ |
|
|
84 void single_step (void); |
|
|
85 |
|
|
86 /* Clear the single-step state. */ |
|
|
87 void clear_single_step (void); |
|
|
88 |
|
|
89 struct gdb_packet; |
|
|
90 |
|
|
91 /* Return 1 when a complete packet has been received, 0 if the packet |
|
|
92 is not yet complete, or -1 if an erroneous packet was NAKed. */ |
|
|
93 int __add_char_to_packet (int character, struct gdb_packet *packet); |
|
|
94 |
|
|
95 /* If the breakpoint we hit is in the breakpoint() instruction, return a |
|
|
96 non-zero value. */ |
|
|
97 extern int __is_breakpoint_function (void); |
|
|
98 |
|
|
99 /* Skip the current instruction. */ |
|
|
100 extern void __skipinst (void); |
|
|
101 |
|
|
102 /* Write the 'T' packet in BUFFER. SIGVAL is the signal the program |
|
|
103 received. */ |
|
|
104 |
|
|
105 extern void __build_t_packet (int sigval, char *buffer); |
|
|
106 |
|
|
107 extern void install_breakpoints (void); |
|
|
108 |
|
|
109 /* Address in text section of a breakpoint instruction. */ |
|
|
110 |
|
|
111 extern void _breakinst (void); |
|
|
112 |
|
|
113 /* The opcode for a breakpoint instruction. */ |
|
|
114 |
|
|
115 extern unsigned long __break_opcode (void); |
|
|
116 |