2
mips_regdefs.c - necessary mips definition for skyeye debugger
3
Copyright (C) 2003 Skyeye Develop Group
4
for help please send mail to <skyeye-developer@lists.sf.linuxforum.net>
6
This program is free software; you can redistribute it and/or modify
7
it under the terms of the GNU General Public License as published by
8
the Free Software Foundation; either version 2 of the License, or
9
(at your option) any later version.
11
This program is distributed in the hope that it will be useful,
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
GNU General Public License for more details.
16
You should have received a copy of the GNU General Public License
17
along with this program; if not, write to the Free Software
18
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22
* 12/21/2006 Michael.Kang <blackfin.kang@gmail.com>
26
* according to GDB_SOURCE/gdb/regformats/mips-reg.dat
28
32:zero 32:at 32:v0 32:v1
29
32:a0 32:a1 32:a2 32:a3
30
32:t0 32:t1 32:t2 32:t3
31
32:t4 32:t5 32:t6 32:t7
32
32:s0 32:s1 32:s2 32:s3
33
32:s4 32:s5 32:s6 32:s7
34
32:t8 32:t9 32:k0 32:k1
35
32:gp 32:sp 32:s8 32:ra
37
32:sr 32:lo 32:hi 32:bad
40
32:f0 32:f1 32:f2 32:f3
41
32:f4 32:f5 32:f6 32:f7
42
32:f8 32:f9 32:f10 32:f11
43
32:f12 32:f13 32:f14 32:f15
44
32:f16 32:f17 32:f18 32:f19
45
32:f20 32:f21 32:f22 32:f23
46
32:f24 32:f25 32:f26 32:f27
47
32:f28 32:f29 32:f30 32:f31
52
#include <skyeye_defs.h>
53
#include "skyeye2gdb.h"
56
static int mips_register_raw_size(int x){
59
static int mips_register_byte(int x){
65
extern MIPS_State* mstate;
67
static int mips_store_register(int rn, unsigned char * memory){
68
uint32_t v = frommem(memory);
69
if(rn >= 0 && rn < 32)
71
else if(rn == 32)/* SR register of CP0 */
77
else if(rn == 35) /* Bad Vaddr */
79
else if(rn == 36) /* Cause */
83
else if(rn >= 38 && rn < 70)
85
else if(rn == 70 || rn == 71 || rn == 72) /* fsr, fir, fp */
89
static int mips_fetch_register(int rn, unsigned char * memory){
91
if(rn >= 0 && rn < 32)
93
else if(rn == 32)/* SR register of CP0 */
99
else if(rn == 35) /* Bad Vaddr */
101
else if(rn == 36) /* Cause */
105
else if(rn >= 38 && rn < 70)
107
else if(rn == 70 || rn == 71 || rn == 72) /* fsr, fir, fp */
116
* register powerpc register type to the array
118
void init_mips_register_defs(void){
119
/* initialize the struct of powerpc register defination */
120
static register_defs_t mips_reg_defs;
121
mips_reg_defs.name = "mips";
122
mips_reg_defs.register_raw_size = mips_register_raw_size;
123
mips_reg_defs.register_bytes = (32 + 6 + 32 + 3)*4;
124
mips_reg_defs.register_byte = mips_register_byte;
125
mips_reg_defs.num_regs = 73; /* the total number of mips register is 73 */
126
mips_reg_defs.max_register_raw_size = 4;
127
mips_reg_defs.store_register = mips_store_register;
128
mips_reg_defs.fetch_register = mips_fetch_register;
130
register_reg_type(&mips_reg_defs);