]>
Commit | Line | Data |
---|---|---|
c3ce8eb3 AF |
1 | /* |
2 | * Alpha gdb server stub | |
3 | * | |
4 | * Copyright (c) 2003-2005 Fabrice Bellard | |
5 | * Copyright (c) 2013 SUSE LINUX Products GmbH | |
6 | * | |
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. | |
11 | * | |
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. | |
16 | * | |
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/>. | |
19 | */ | |
20 | ||
21 | static int cpu_gdb_read_register(CPUAlphaState *env, uint8_t *mem_buf, int n) | |
22 | { | |
23 | uint64_t val; | |
24 | CPU_DoubleU d; | |
25 | ||
26 | switch (n) { | |
27 | case 0 ... 30: | |
28 | val = env->ir[n]; | |
29 | break; | |
30 | case 32 ... 62: | |
31 | d.d = env->fir[n - 32]; | |
32 | val = d.ll; | |
33 | break; | |
34 | case 63: | |
35 | val = cpu_alpha_load_fpcr(env); | |
36 | break; | |
37 | case 64: | |
38 | val = env->pc; | |
39 | break; | |
40 | case 66: | |
41 | val = env->unique; | |
42 | break; | |
43 | case 31: | |
44 | case 65: | |
45 | /* 31 really is the zero register; 65 is unassigned in the | |
46 | gdb protocol, but is still required to occupy 8 bytes. */ | |
47 | val = 0; | |
48 | break; | |
49 | default: | |
50 | return 0; | |
51 | } | |
986a2998 | 52 | return gdb_get_regl(mem_buf, val); |
c3ce8eb3 AF |
53 | } |
54 | ||
55 | static int cpu_gdb_write_register(CPUAlphaState *env, uint8_t *mem_buf, int n) | |
56 | { | |
57 | target_ulong tmp = ldtul_p(mem_buf); | |
58 | CPU_DoubleU d; | |
59 | ||
60 | switch (n) { | |
61 | case 0 ... 30: | |
62 | env->ir[n] = tmp; | |
63 | break; | |
64 | case 32 ... 62: | |
65 | d.ll = tmp; | |
66 | env->fir[n - 32] = d.d; | |
67 | break; | |
68 | case 63: | |
69 | cpu_alpha_store_fpcr(env, tmp); | |
70 | break; | |
71 | case 64: | |
72 | env->pc = tmp; | |
73 | break; | |
74 | case 66: | |
75 | env->unique = tmp; | |
76 | break; | |
77 | case 31: | |
78 | case 65: | |
79 | /* 31 really is the zero register; 65 is unassigned in the | |
80 | gdb protocol, but is still required to occupy 8 bytes. */ | |
81 | break; | |
82 | default: | |
83 | return 0; | |
84 | } | |
85 | return 8; | |
86 | } |