Lines Matching +full:cs +full:- +full:0
4 * Copyright (c) 2003-2005 Fabrice Bellard
23 #include "s390x-internal.h"
24 #include "exec/exec-all.h"
31 int s390_cpu_gdb_read_register(CPUState *cs, GByteArray *mem_buf, int n) in s390_cpu_gdb_read_register() argument
33 CPUS390XState *env = cpu_env(cs); in s390_cpu_gdb_read_register()
39 return gdb_get_regl(mem_buf, env->psw.addr); in s390_cpu_gdb_read_register()
41 return gdb_get_regl(mem_buf, env->regs[n - S390_R0_REGNUM]); in s390_cpu_gdb_read_register()
43 return 0; in s390_cpu_gdb_read_register()
46 int s390_cpu_gdb_write_register(CPUState *cs, uint8_t *mem_buf, int n) in s390_cpu_gdb_write_register() argument
48 CPUS390XState *env = cpu_env(cs); in s390_cpu_gdb_write_register()
53 s390_cpu_set_psw(env, tmpl, env->psw.addr); in s390_cpu_gdb_write_register()
56 env->psw.addr = tmpl; in s390_cpu_gdb_write_register()
59 env->regs[n - S390_R0_REGNUM] = tmpl; in s390_cpu_gdb_write_register()
62 return 0; in s390_cpu_gdb_write_register()
67 /* the values represent the positions in s390-acr.xml */
68 #define S390_A0_REGNUM 0
71 static int cpu_read_ac_reg(CPUState *cs, GByteArray *buf, int n) in cpu_read_ac_reg() argument
73 S390CPU *cpu = S390_CPU(cs); in cpu_read_ac_reg()
74 CPUS390XState *env = &cpu->env; in cpu_read_ac_reg()
78 return gdb_get_reg32(buf, env->aregs[n]); in cpu_read_ac_reg()
80 return 0; in cpu_read_ac_reg()
84 static int cpu_write_ac_reg(CPUState *cs, uint8_t *mem_buf, int n) in cpu_write_ac_reg() argument
86 S390CPU *cpu = S390_CPU(cs); in cpu_write_ac_reg()
87 CPUS390XState *env = &cpu->env; in cpu_write_ac_reg()
91 env->aregs[n] = ldl_be_p(mem_buf); in cpu_write_ac_reg()
95 return 0; in cpu_write_ac_reg()
99 /* the values represent the positions in s390-fpr.xml */
100 #define S390_FPC_REGNUM 0
104 static int cpu_read_fp_reg(CPUState *cs, GByteArray *buf, int n) in cpu_read_fp_reg() argument
106 S390CPU *cpu = S390_CPU(cs); in cpu_read_fp_reg()
107 CPUS390XState *env = &cpu->env; in cpu_read_fp_reg()
111 return gdb_get_reg32(buf, env->fpc); in cpu_read_fp_reg()
113 return gdb_get_reg64(buf, *get_freg(env, n - S390_F0_REGNUM)); in cpu_read_fp_reg()
115 return 0; in cpu_read_fp_reg()
119 static int cpu_write_fp_reg(CPUState *cs, uint8_t *mem_buf, int n) in cpu_write_fp_reg() argument
121 S390CPU *cpu = S390_CPU(cs); in cpu_write_fp_reg()
122 CPUS390XState *env = &cpu->env; in cpu_write_fp_reg()
126 env->fpc = ldl_be_p(mem_buf); in cpu_write_fp_reg()
129 *get_freg(env, n - S390_F0_REGNUM) = ldq_be_p(mem_buf); in cpu_write_fp_reg()
132 return 0; in cpu_write_fp_reg()
136 /* the values represent the positions in s390-vx.xml */
137 #define S390_V0L_REGNUM 0
142 static int cpu_read_vreg(CPUState *cs, GByteArray *buf, int n) in cpu_read_vreg() argument
144 S390CPU *cpu = S390_CPU(cs); in cpu_read_vreg()
145 CPUS390XState *env = &cpu->env; in cpu_read_vreg()
150 ret = gdb_get_reg64(buf, env->vregs[n][1]); in cpu_read_vreg()
153 ret = gdb_get_reg64(buf, env->vregs[n][0]); in cpu_read_vreg()
154 ret += gdb_get_reg64(buf, env->vregs[n][1]); in cpu_read_vreg()
157 ret = 0; in cpu_read_vreg()
163 static int cpu_write_vreg(CPUState *cs, uint8_t *mem_buf, int n) in cpu_write_vreg() argument
165 S390CPU *cpu = S390_CPU(cs); in cpu_write_vreg()
166 CPUS390XState *env = &cpu->env; in cpu_write_vreg()
170 env->vregs[n][1] = ldq_be_p(mem_buf + 8); in cpu_write_vreg()
173 env->vregs[n][0] = ldq_be_p(mem_buf); in cpu_write_vreg()
174 env->vregs[n][1] = ldq_be_p(mem_buf + 8); in cpu_write_vreg()
177 return 0; in cpu_write_vreg()
181 /* the values represent the positions in s390-cr.xml */
182 #define S390_C0_REGNUM 0
186 static int cpu_read_c_reg(CPUState *cs, GByteArray *buf, int n) in cpu_read_c_reg() argument
188 S390CPU *cpu = S390_CPU(cs); in cpu_read_c_reg()
189 CPUS390XState *env = &cpu->env; in cpu_read_c_reg()
193 return gdb_get_regl(buf, env->cregs[n]); in cpu_read_c_reg()
195 return 0; in cpu_read_c_reg()
199 static int cpu_write_c_reg(CPUState *cs, uint8_t *mem_buf, int n) in cpu_write_c_reg() argument
201 S390CPU *cpu = S390_CPU(cs); in cpu_write_c_reg()
202 CPUS390XState *env = &cpu->env; in cpu_write_c_reg()
206 env->cregs[n] = ldq_be_p(mem_buf); in cpu_write_c_reg()
213 return 0; in cpu_write_c_reg()
217 /* the values represent the positions in s390-virt.xml */
218 #define S390_VIRT_CKC_REGNUM 0
223 static int cpu_read_virt_reg(CPUState *cs, GByteArray *mem_buf, int n) in cpu_read_virt_reg() argument
225 S390CPU *cpu = S390_CPU(cs); in cpu_read_virt_reg()
226 CPUS390XState *env = &cpu->env; in cpu_read_virt_reg()
230 return gdb_get_regl(mem_buf, env->ckc); in cpu_read_virt_reg()
232 return gdb_get_regl(mem_buf, env->cputm); in cpu_read_virt_reg()
234 return gdb_get_regl(mem_buf, env->gbea); in cpu_read_virt_reg()
236 return gdb_get_regl(mem_buf, env->psa); in cpu_read_virt_reg()
238 return 0; in cpu_read_virt_reg()
242 static int cpu_write_virt_reg(CPUState *cs, uint8_t *mem_buf, int n) in cpu_write_virt_reg() argument
244 S390CPU *cpu = S390_CPU(cs); in cpu_write_virt_reg()
245 CPUS390XState *env = &cpu->env; in cpu_write_virt_reg()
249 env->ckc = ldq_be_p(mem_buf); in cpu_write_virt_reg()
250 cpu_synchronize_post_init(cs); in cpu_write_virt_reg()
253 env->cputm = ldq_be_p(mem_buf); in cpu_write_virt_reg()
254 cpu_synchronize_post_init(cs); in cpu_write_virt_reg()
257 env->gbea = ldq_be_p(mem_buf); in cpu_write_virt_reg()
258 cpu_synchronize_post_init(cs); in cpu_write_virt_reg()
261 env->psa = ldq_be_p(mem_buf); in cpu_write_virt_reg()
262 cpu_synchronize_post_init(cs); in cpu_write_virt_reg()
265 return 0; in cpu_write_virt_reg()
269 /* the values represent the positions in s390-virt-kvm.xml */
270 #define S390_VIRT_KVM_PP_REGNUM 0
275 static int cpu_read_virt_kvm_reg(CPUState *cs, GByteArray *mem_buf, int n) in cpu_read_virt_kvm_reg() argument
277 S390CPU *cpu = S390_CPU(cs); in cpu_read_virt_kvm_reg()
278 CPUS390XState *env = &cpu->env; in cpu_read_virt_kvm_reg()
282 return gdb_get_regl(mem_buf, env->pp); in cpu_read_virt_kvm_reg()
284 return gdb_get_regl(mem_buf, env->pfault_token); in cpu_read_virt_kvm_reg()
286 return gdb_get_regl(mem_buf, env->pfault_select); in cpu_read_virt_kvm_reg()
288 return gdb_get_regl(mem_buf, env->pfault_compare); in cpu_read_virt_kvm_reg()
290 return 0; in cpu_read_virt_kvm_reg()
294 static int cpu_write_virt_kvm_reg(CPUState *cs, uint8_t *mem_buf, int n) in cpu_write_virt_kvm_reg() argument
296 S390CPU *cpu = S390_CPU(cs); in cpu_write_virt_kvm_reg()
297 CPUS390XState *env = &cpu->env; in cpu_write_virt_kvm_reg()
301 env->pp = ldq_be_p(mem_buf); in cpu_write_virt_kvm_reg()
305 env->pfault_token = ldq_be_p(mem_buf); in cpu_write_virt_kvm_reg()
309 env->pfault_select = ldq_be_p(mem_buf); in cpu_write_virt_kvm_reg()
313 env->pfault_compare = ldq_be_p(mem_buf); in cpu_write_virt_kvm_reg()
317 return 0; in cpu_write_virt_kvm_reg()
322 /* the values represent the positions in s390-gs.xml */
323 #define S390_GS_RESERVED_REGNUM 0
328 static int cpu_read_gs_reg(CPUState *cs, GByteArray *buf, int n) in cpu_read_gs_reg() argument
330 S390CPU *cpu = S390_CPU(cs); in cpu_read_gs_reg()
331 CPUS390XState *env = &cpu->env; in cpu_read_gs_reg()
333 return gdb_get_regl(buf, env->gscb[n]); in cpu_read_gs_reg()
336 static int cpu_write_gs_reg(CPUState *cs, uint8_t *mem_buf, int n) in cpu_write_gs_reg() argument
338 S390CPU *cpu = S390_CPU(cs); in cpu_write_gs_reg()
339 CPUS390XState *env = &cpu->env; in cpu_write_gs_reg()
341 env->gscb[n] = ldq_be_p(mem_buf); in cpu_write_gs_reg()
346 void s390_cpu_gdb_init(CPUState *cs) in s390_cpu_gdb_init() argument
348 gdb_register_coprocessor(cs, cpu_read_ac_reg, in s390_cpu_gdb_init()
350 gdb_find_static_feature("s390-acr.xml"), 0); in s390_cpu_gdb_init()
352 gdb_register_coprocessor(cs, cpu_read_fp_reg, in s390_cpu_gdb_init()
354 gdb_find_static_feature("s390-fpr.xml"), 0); in s390_cpu_gdb_init()
356 gdb_register_coprocessor(cs, cpu_read_vreg, in s390_cpu_gdb_init()
358 gdb_find_static_feature("s390-vx.xml"), 0); in s390_cpu_gdb_init()
360 gdb_register_coprocessor(cs, cpu_read_gs_reg, in s390_cpu_gdb_init()
362 gdb_find_static_feature("s390-gs.xml"), 0); in s390_cpu_gdb_init()
365 gdb_register_coprocessor(cs, cpu_read_c_reg, in s390_cpu_gdb_init()
367 gdb_find_static_feature("s390-cr.xml"), 0); in s390_cpu_gdb_init()
369 gdb_register_coprocessor(cs, cpu_read_virt_reg, in s390_cpu_gdb_init()
371 gdb_find_static_feature("s390-virt.xml"), 0); in s390_cpu_gdb_init()
374 gdb_register_coprocessor(cs, cpu_read_virt_kvm_reg, in s390_cpu_gdb_init()
376 gdb_find_static_feature("s390-virt-kvm.xml"), in s390_cpu_gdb_init()
377 0); in s390_cpu_gdb_init()