]>
git.proxmox.com Git - mirror_qemu.git/blob - target-mips/gdbstub.c
4 * Copyright (c) 2003-2005 Fabrice Bellard
5 * Copyright (c) 2013 SUSE LINUX Products GmbH
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, see <http://www.gnu.org/licenses/>.
21 static int cpu_gdb_read_register(CPUMIPSState
*env
, uint8_t *mem_buf
, int n
)
24 GET_REGL(env
->active_tc
.gpr
[n
]);
26 if (env
->CP0_Config1
& (1 << CP0C1_FP
)) {
27 if (n
>= 38 && n
< 70) {
28 if (env
->CP0_Status
& (1 << CP0St_FR
)) {
29 GET_REGL(env
->active_fpu
.fpr
[n
- 38].d
);
31 GET_REGL(env
->active_fpu
.fpr
[n
- 38].w
[FP_ENDIAN_IDX
]);
36 GET_REGL((int32_t)env
->active_fpu
.fcr31
);
38 GET_REGL((int32_t)env
->active_fpu
.fcr0
);
43 GET_REGL((int32_t)env
->CP0_Status
);
45 GET_REGL(env
->active_tc
.LO
[0]);
47 GET_REGL(env
->active_tc
.HI
[0]);
49 GET_REGL(env
->CP0_BadVAddr
);
51 GET_REGL((int32_t)env
->CP0_Cause
);
53 GET_REGL(env
->active_tc
.PC
| !!(env
->hflags
& MIPS_HFLAG_M16
));
57 GET_REGL((int32_t)env
->CP0_PRid
);
59 if (n
>= 73 && n
<= 88) {
60 /* 16 embedded regs. */
67 /* convert MIPS rounding mode in FCR31 to IEEE library */
68 static unsigned int ieee_rm
[] = {
69 float_round_nearest_even
,
74 #define RESTORE_ROUNDING_MODE \
75 set_float_rounding_mode(ieee_rm[env->active_fpu.fcr31 & 3], \
76 &env->active_fpu.fp_status)
78 static int cpu_gdb_write_register(CPUMIPSState
*env
, uint8_t *mem_buf
, int n
)
82 tmp
= ldtul_p(mem_buf
);
85 env
->active_tc
.gpr
[n
] = tmp
;
86 return sizeof(target_ulong
);
88 if (env
->CP0_Config1
& (1 << CP0C1_FP
)
89 && n
>= 38 && n
< 73) {
91 if (env
->CP0_Status
& (1 << CP0St_FR
)) {
92 env
->active_fpu
.fpr
[n
- 38].d
= tmp
;
94 env
->active_fpu
.fpr
[n
- 38].w
[FP_ENDIAN_IDX
] = tmp
;
99 env
->active_fpu
.fcr31
= tmp
& 0xFF83FFFF;
100 /* set rounding mode */
101 RESTORE_ROUNDING_MODE
;
104 env
->active_fpu
.fcr0
= tmp
;
107 return sizeof(target_ulong
);
111 env
->CP0_Status
= tmp
;
114 env
->active_tc
.LO
[0] = tmp
;
117 env
->active_tc
.HI
[0] = tmp
;
120 env
->CP0_BadVAddr
= tmp
;
123 env
->CP0_Cause
= tmp
;
126 env
->active_tc
.PC
= tmp
& ~(target_ulong
)1;
128 env
->hflags
|= MIPS_HFLAG_M16
;
130 env
->hflags
&= ~(MIPS_HFLAG_M16
);
133 case 72: /* fp, ignored */
139 /* Other registers are readonly. Ignore writes. */
143 return sizeof(target_ulong
);