1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20#include "qemu/osdep.h"
21#include "qemu-common.h"
22#include "cpu.h"
23#include "exec/gdbstub.h"
24
25int hppa_cpu_gdb_read_register(CPUState *cs, uint8_t *mem_buf, int n)
26{
27 HPPACPU *cpu = HPPA_CPU(cs);
28 CPUHPPAState *env = &cpu->env;
29 target_ulong val;
30
31 switch (n) {
32 case 0:
33 val = cpu_hppa_get_psw(env);
34 break;
35 case 1 ... 31:
36 val = env->gr[n];
37 break;
38 case 32:
39 val = env->sar;
40 break;
41 case 33:
42 val = env->iaoq_f;
43 break;
44 case 35:
45 val = env->iaoq_b;
46 break;
47 case 59:
48 val = env->cr26;
49 break;
50 case 60:
51 val = env->cr27;
52 break;
53 case 64 ... 127:
54 val = extract64(env->fr[(n - 64) / 2], (n & 1 ? 0 : 32), 32);
55 break;
56 default:
57 if (n < 128) {
58 val = 0;
59 } else {
60 return 0;
61 }
62 break;
63 }
64 return gdb_get_regl(mem_buf, val);
65}
66
67int hppa_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n)
68{
69 HPPACPU *cpu = HPPA_CPU(cs);
70 CPUHPPAState *env = &cpu->env;
71 target_ulong val = ldtul_p(mem_buf);
72
73 switch (n) {
74 case 0:
75 cpu_hppa_put_psw(env, val);
76 break;
77 case 1 ... 31:
78 env->gr[n] = val;
79 break;
80 case 32:
81 env->sar = val;
82 break;
83 case 33:
84 env->iaoq_f = val;
85 break;
86 case 35:
87 env->iaoq_b = val;
88 break;
89 case 59:
90 env->cr26 = val;
91 break;
92 case 60:
93 env->cr27 = val;
94 break;
95 case 64:
96 env->fr[0] = deposit64(env->fr[0], 32, 32, val);
97 cpu_hppa_loaded_fr0(env);
98 break;
99 case 65 ... 127:
100 {
101 uint64_t *fr = &env->fr[(n - 64) / 2];
102 *fr = deposit64(*fr, val, (n & 1 ? 0 : 32), 32);
103 }
104 break;
105 default:
106 if (n >= 128) {
107 return 0;
108 }
109 break;
110 }
111 return sizeof(target_ulong);
112}
113