Commit 6f970bd90ec4ee73cf7a27616d44f1a1e0056532
1 parent
89984cd2
MIPS support and memory access error reporting (Daniel Jacobowitz)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1685 c046a42c-6fe2-441c-8c8c-71466251a162
Showing
1 changed file
with
72 additions
and
4 deletions
gdbstub.c
... | ... | @@ -421,6 +421,72 @@ static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size) |
421 | 421 | ptr += 8 * 12 + 4; |
422 | 422 | cpsr_write (env, tswapl(*(uint32_t *)ptr), 0xffffffff); |
423 | 423 | } |
424 | +#elif defined (TARGET_MIPS) | |
425 | +static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf) | |
426 | +{ | |
427 | + int i; | |
428 | + uint8_t *ptr; | |
429 | + | |
430 | + ptr = mem_buf; | |
431 | + for (i = 0; i < 32; i++) | |
432 | + { | |
433 | + *(uint32_t *)ptr = tswapl(env->gpr[i]); | |
434 | + ptr += 4; | |
435 | + } | |
436 | + | |
437 | + *(uint32_t *)ptr = tswapl(env->CP0_Status); | |
438 | + ptr += 4; | |
439 | + | |
440 | + *(uint32_t *)ptr = tswapl(env->LO); | |
441 | + ptr += 4; | |
442 | + | |
443 | + *(uint32_t *)ptr = tswapl(env->HI); | |
444 | + ptr += 4; | |
445 | + | |
446 | + *(uint32_t *)ptr = tswapl(env->CP0_BadVAddr); | |
447 | + ptr += 4; | |
448 | + | |
449 | + *(uint32_t *)ptr = tswapl(env->CP0_Cause); | |
450 | + ptr += 4; | |
451 | + | |
452 | + *(uint32_t *)ptr = tswapl(env->PC); | |
453 | + ptr += 4; | |
454 | + | |
455 | + /* 32 FP registers, fsr, fir, fp. Not yet implemented. */ | |
456 | + | |
457 | + return ptr - mem_buf; | |
458 | +} | |
459 | + | |
460 | +static void cpu_gdb_write_registers(CPUState *env, uint8_t *mem_buf, int size) | |
461 | +{ | |
462 | + int i; | |
463 | + uint8_t *ptr; | |
464 | + | |
465 | + ptr = mem_buf; | |
466 | + for (i = 0; i < 32; i++) | |
467 | + { | |
468 | + env->gpr[i] = tswapl(*(uint32_t *)ptr); | |
469 | + ptr += 4; | |
470 | + } | |
471 | + | |
472 | + env->CP0_Status = tswapl(*(uint32_t *)ptr); | |
473 | + ptr += 4; | |
474 | + | |
475 | + env->LO = tswapl(*(uint32_t *)ptr); | |
476 | + ptr += 4; | |
477 | + | |
478 | + env->HI = tswapl(*(uint32_t *)ptr); | |
479 | + ptr += 4; | |
480 | + | |
481 | + env->CP0_BadVAddr = tswapl(*(uint32_t *)ptr); | |
482 | + ptr += 4; | |
483 | + | |
484 | + env->CP0_Cause = tswapl(*(uint32_t *)ptr); | |
485 | + ptr += 4; | |
486 | + | |
487 | + env->PC = tswapl(*(uint32_t *)ptr); | |
488 | + ptr += 4; | |
489 | +} | |
424 | 490 | #else |
425 | 491 | static int cpu_gdb_read_registers(CPUState *env, uint8_t *mem_buf) |
426 | 492 | { |
... | ... | @@ -511,10 +577,12 @@ static int gdb_handle_packet(GDBState *s, CPUState *env, const char *line_buf) |
511 | 577 | if (*p == ',') |
512 | 578 | p++; |
513 | 579 | len = strtoul(p, NULL, 16); |
514 | - if (cpu_memory_rw_debug(env, addr, mem_buf, len, 0) != 0) | |
515 | - memset(mem_buf, 0, len); | |
516 | - memtohex(buf, mem_buf, len); | |
517 | - put_packet(s, buf); | |
580 | + if (cpu_memory_rw_debug(env, addr, mem_buf, len, 0) != 0) { | |
581 | + put_packet (s, "E14"); | |
582 | + } else { | |
583 | + memtohex(buf, mem_buf, len); | |
584 | + put_packet(s, buf); | |
585 | + } | |
518 | 586 | break; |
519 | 587 | case 'M': |
520 | 588 | addr = strtoul(p, (char **)&p, 16); | ... | ... |