gdbstub.c (9e34f127f419b3941b36dfdfac79640dc81e97e2) | gdbstub.c (ac1e86710000ba3cf2e80836fb3f66ba12b169b8) |
---|---|
1/* 2 * s390x 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 --- 53 unchanged lines hidden (view full) --- 62 return 0; 63 } 64 return 8; 65} 66 67/* the values represent the positions in s390-acr.xml */ 68#define S390_A0_REGNUM 0 69#define S390_A15_REGNUM 15 | 1/* 2 * s390x 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 --- 53 unchanged lines hidden (view full) --- 62 return 0; 63 } 64 return 8; 65} 66 67/* the values represent the positions in s390-acr.xml */ 68#define S390_A0_REGNUM 0 69#define S390_A15_REGNUM 15 |
70/* total number of registers in s390-acr.xml */ 71#define S390_NUM_AC_REGS 16 | |
72 73static int cpu_read_ac_reg(CPUS390XState *env, GByteArray *buf, int n) 74{ 75 switch (n) { 76 case S390_A0_REGNUM ... S390_A15_REGNUM: 77 return gdb_get_reg32(buf, env->aregs[n]); 78 default: 79 return 0; --- 11 unchanged lines hidden (view full) --- 91 return 0; 92 } 93} 94 95/* the values represent the positions in s390-fpr.xml */ 96#define S390_FPC_REGNUM 0 97#define S390_F0_REGNUM 1 98#define S390_F15_REGNUM 16 | 70 71static int cpu_read_ac_reg(CPUS390XState *env, GByteArray *buf, int n) 72{ 73 switch (n) { 74 case S390_A0_REGNUM ... S390_A15_REGNUM: 75 return gdb_get_reg32(buf, env->aregs[n]); 76 default: 77 return 0; --- 11 unchanged lines hidden (view full) --- 89 return 0; 90 } 91} 92 93/* the values represent the positions in s390-fpr.xml */ 94#define S390_FPC_REGNUM 0 95#define S390_F0_REGNUM 1 96#define S390_F15_REGNUM 16 |
99/* total number of registers in s390-fpr.xml */ 100#define S390_NUM_FP_REGS 17 | |
101 102static int cpu_read_fp_reg(CPUS390XState *env, GByteArray *buf, int n) 103{ 104 switch (n) { 105 case S390_FPC_REGNUM: 106 return gdb_get_reg32(buf, env->fpc); 107 case S390_F0_REGNUM ... S390_F15_REGNUM: 108 return gdb_get_reg64(buf, *get_freg(env, n - S390_F0_REGNUM)); --- 16 unchanged lines hidden (view full) --- 125 } 126} 127 128/* the values represent the positions in s390-vx.xml */ 129#define S390_V0L_REGNUM 0 130#define S390_V15L_REGNUM 15 131#define S390_V16_REGNUM 16 132#define S390_V31_REGNUM 31 | 97 98static int cpu_read_fp_reg(CPUS390XState *env, GByteArray *buf, int n) 99{ 100 switch (n) { 101 case S390_FPC_REGNUM: 102 return gdb_get_reg32(buf, env->fpc); 103 case S390_F0_REGNUM ... S390_F15_REGNUM: 104 return gdb_get_reg64(buf, *get_freg(env, n - S390_F0_REGNUM)); --- 16 unchanged lines hidden (view full) --- 121 } 122} 123 124/* the values represent the positions in s390-vx.xml */ 125#define S390_V0L_REGNUM 0 126#define S390_V15L_REGNUM 15 127#define S390_V16_REGNUM 16 128#define S390_V31_REGNUM 31 |
133/* total number of registers in s390-vx.xml */ 134#define S390_NUM_VREGS 32 | |
135 136static int cpu_read_vreg(CPUS390XState *env, GByteArray *buf, int n) 137{ 138 int ret; 139 140 switch (n) { 141 case S390_V0L_REGNUM ... S390_V15L_REGNUM: 142 ret = gdb_get_reg64(buf, env->vregs[n][1]); --- 22 unchanged lines hidden (view full) --- 165 default: 166 return 0; 167 } 168} 169 170/* the values represent the positions in s390-cr.xml */ 171#define S390_C0_REGNUM 0 172#define S390_C15_REGNUM 15 | 129 130static int cpu_read_vreg(CPUS390XState *env, GByteArray *buf, int n) 131{ 132 int ret; 133 134 switch (n) { 135 case S390_V0L_REGNUM ... S390_V15L_REGNUM: 136 ret = gdb_get_reg64(buf, env->vregs[n][1]); --- 22 unchanged lines hidden (view full) --- 159 default: 160 return 0; 161 } 162} 163 164/* the values represent the positions in s390-cr.xml */ 165#define S390_C0_REGNUM 0 166#define S390_C15_REGNUM 15 |
173/* total number of registers in s390-cr.xml */ 174#define S390_NUM_C_REGS 16 | |
175 176#ifndef CONFIG_USER_ONLY 177static int cpu_read_c_reg(CPUS390XState *env, GByteArray *buf, int n) 178{ 179 switch (n) { 180 case S390_C0_REGNUM ... S390_C15_REGNUM: 181 return gdb_get_regl(buf, env->cregs[n]); 182 default: --- 16 unchanged lines hidden (view full) --- 199 } 200} 201 202/* the values represent the positions in s390-virt.xml */ 203#define S390_VIRT_CKC_REGNUM 0 204#define S390_VIRT_CPUTM_REGNUM 1 205#define S390_VIRT_BEA_REGNUM 2 206#define S390_VIRT_PREFIX_REGNUM 3 | 167 168#ifndef CONFIG_USER_ONLY 169static int cpu_read_c_reg(CPUS390XState *env, GByteArray *buf, int n) 170{ 171 switch (n) { 172 case S390_C0_REGNUM ... S390_C15_REGNUM: 173 return gdb_get_regl(buf, env->cregs[n]); 174 default: --- 16 unchanged lines hidden (view full) --- 191 } 192} 193 194/* the values represent the positions in s390-virt.xml */ 195#define S390_VIRT_CKC_REGNUM 0 196#define S390_VIRT_CPUTM_REGNUM 1 197#define S390_VIRT_BEA_REGNUM 2 198#define S390_VIRT_PREFIX_REGNUM 3 |
207/* total number of registers in s390-virt.xml */ 208#define S390_NUM_VIRT_REGS 4 | |
209 210static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n) 211{ 212 switch (n) { 213 case S390_VIRT_CKC_REGNUM: 214 return gdb_get_regl(mem_buf, env->ckc); 215 case S390_VIRT_CPUTM_REGNUM: 216 return gdb_get_regl(mem_buf, env->cputm); --- 30 unchanged lines hidden (view full) --- 247 } 248} 249 250/* the values represent the positions in s390-virt-kvm.xml */ 251#define S390_VIRT_KVM_PP_REGNUM 0 252#define S390_VIRT_KVM_PFT_REGNUM 1 253#define S390_VIRT_KVM_PFS_REGNUM 2 254#define S390_VIRT_KVM_PFC_REGNUM 3 | 199 200static int cpu_read_virt_reg(CPUS390XState *env, GByteArray *mem_buf, int n) 201{ 202 switch (n) { 203 case S390_VIRT_CKC_REGNUM: 204 return gdb_get_regl(mem_buf, env->ckc); 205 case S390_VIRT_CPUTM_REGNUM: 206 return gdb_get_regl(mem_buf, env->cputm); --- 30 unchanged lines hidden (view full) --- 237 } 238} 239 240/* the values represent the positions in s390-virt-kvm.xml */ 241#define S390_VIRT_KVM_PP_REGNUM 0 242#define S390_VIRT_KVM_PFT_REGNUM 1 243#define S390_VIRT_KVM_PFS_REGNUM 2 244#define S390_VIRT_KVM_PFC_REGNUM 3 |
255/* total number of registers in s390-virt-kvm.xml */ 256#define S390_NUM_VIRT_KVM_REGS 4 | |
257 258static int cpu_read_virt_kvm_reg(CPUS390XState *env, GByteArray *mem_buf, int n) 259{ 260 switch (n) { 261 case S390_VIRT_KVM_PP_REGNUM: 262 return gdb_get_regl(mem_buf, env->pp); 263 case S390_VIRT_KVM_PFT_REGNUM: 264 return gdb_get_regl(mem_buf, env->pfault_token); --- 31 unchanged lines hidden (view full) --- 296} 297#endif 298 299/* the values represent the positions in s390-gs.xml */ 300#define S390_GS_RESERVED_REGNUM 0 301#define S390_GS_GSD_REGNUM 1 302#define S390_GS_GSSM_REGNUM 2 303#define S390_GS_GSEPLA_REGNUM 3 | 245 246static int cpu_read_virt_kvm_reg(CPUS390XState *env, GByteArray *mem_buf, int n) 247{ 248 switch (n) { 249 case S390_VIRT_KVM_PP_REGNUM: 250 return gdb_get_regl(mem_buf, env->pp); 251 case S390_VIRT_KVM_PFT_REGNUM: 252 return gdb_get_regl(mem_buf, env->pfault_token); --- 31 unchanged lines hidden (view full) --- 284} 285#endif 286 287/* the values represent the positions in s390-gs.xml */ 288#define S390_GS_RESERVED_REGNUM 0 289#define S390_GS_GSD_REGNUM 1 290#define S390_GS_GSSM_REGNUM 2 291#define S390_GS_GSEPLA_REGNUM 3 |
304/* total number of registers in s390-gs.xml */ 305#define S390_NUM_GS_REGS 4 | |
306 307static int cpu_read_gs_reg(CPUS390XState *env, GByteArray *buf, int n) 308{ 309 return gdb_get_regl(buf, env->gscb[n]); 310} 311 312static int cpu_write_gs_reg(CPUS390XState *env, uint8_t *mem_buf, int n) 313{ 314 env->gscb[n] = ldtul_p(mem_buf); 315 cpu_synchronize_post_init(env_cpu(env)); 316 return 8; 317} 318 319void s390_cpu_gdb_init(CPUState *cs) 320{ 321 gdb_register_coprocessor(cs, cpu_read_ac_reg, 322 cpu_write_ac_reg, | 292 293static int cpu_read_gs_reg(CPUS390XState *env, GByteArray *buf, int n) 294{ 295 return gdb_get_regl(buf, env->gscb[n]); 296} 297 298static int cpu_write_gs_reg(CPUS390XState *env, uint8_t *mem_buf, int n) 299{ 300 env->gscb[n] = ldtul_p(mem_buf); 301 cpu_synchronize_post_init(env_cpu(env)); 302 return 8; 303} 304 305void s390_cpu_gdb_init(CPUState *cs) 306{ 307 gdb_register_coprocessor(cs, cpu_read_ac_reg, 308 cpu_write_ac_reg, |
323 S390_NUM_AC_REGS, "s390-acr.xml", 0); | 309 gdb_find_static_feature("s390-acr.xml"), 0); |
324 325 gdb_register_coprocessor(cs, cpu_read_fp_reg, 326 cpu_write_fp_reg, | 310 311 gdb_register_coprocessor(cs, cpu_read_fp_reg, 312 cpu_write_fp_reg, |
327 S390_NUM_FP_REGS, "s390-fpr.xml", 0); | 313 gdb_find_static_feature("s390-fpr.xml"), 0); |
328 329 gdb_register_coprocessor(cs, cpu_read_vreg, 330 cpu_write_vreg, | 314 315 gdb_register_coprocessor(cs, cpu_read_vreg, 316 cpu_write_vreg, |
331 S390_NUM_VREGS, "s390-vx.xml", 0); | 317 gdb_find_static_feature("s390-vx.xml"), 0); |
332 333 gdb_register_coprocessor(cs, cpu_read_gs_reg, 334 cpu_write_gs_reg, | 318 319 gdb_register_coprocessor(cs, cpu_read_gs_reg, 320 cpu_write_gs_reg, |
335 S390_NUM_GS_REGS, "s390-gs.xml", 0); | 321 gdb_find_static_feature("s390-gs.xml"), 0); |
336 337#ifndef CONFIG_USER_ONLY 338 gdb_register_coprocessor(cs, cpu_read_c_reg, 339 cpu_write_c_reg, | 322 323#ifndef CONFIG_USER_ONLY 324 gdb_register_coprocessor(cs, cpu_read_c_reg, 325 cpu_write_c_reg, |
340 S390_NUM_C_REGS, "s390-cr.xml", 0); | 326 gdb_find_static_feature("s390-cr.xml"), 0); |
341 342 gdb_register_coprocessor(cs, cpu_read_virt_reg, 343 cpu_write_virt_reg, | 327 328 gdb_register_coprocessor(cs, cpu_read_virt_reg, 329 cpu_write_virt_reg, |
344 S390_NUM_VIRT_REGS, "s390-virt.xml", 0); | 330 gdb_find_static_feature("s390-virt.xml"), 0); |
345 346 if (kvm_enabled()) { 347 gdb_register_coprocessor(cs, cpu_read_virt_kvm_reg, 348 cpu_write_virt_kvm_reg, | 331 332 if (kvm_enabled()) { 333 gdb_register_coprocessor(cs, cpu_read_virt_kvm_reg, 334 cpu_write_virt_kvm_reg, |
349 S390_NUM_VIRT_KVM_REGS, "s390-virt-kvm.xml", | 335 gdb_find_static_feature("s390-virt-kvm.xml"), |
350 0); 351 } 352#endif 353} | 336 0); 337 } 338#endif 339} |