Commit 5e2972fdab75341357d7fd23859b887491c932a9

Authored by aliguori
1 parent 26b258e1

ROM write access for debugging (Jan Kiszka)

Enhance cpu_memory_rw_debug so that it can write even to ROM regions.
This allows to modify ROM via gdb (I see no point in denying this to the
user), and it will enable us to drop kvm_patch_opcode_byte().

Credits go to Avi for suggesting this.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>


git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@6905 c046a42c-6fe2-441c-8c8c-71466251a162
Showing 1 changed file with 8 additions and 3 deletions
... ... @@ -3448,7 +3448,7 @@ void stq_phys(target_phys_addr_t addr, uint64_t val)
3448 3448  
3449 3449 #endif
3450 3450  
3451   -/* virtual memory access for debug */
  3451 +/* virtual memory access for debug (includes writing to ROM) */
3452 3452 int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
3453 3453 uint8_t *buf, int len, int is_write)
3454 3454 {
... ... @@ -3465,8 +3465,13 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong addr,
3465 3465 l = (page + TARGET_PAGE_SIZE) - addr;
3466 3466 if (l > len)
3467 3467 l = len;
3468   - cpu_physical_memory_rw(phys_addr + (addr & ~TARGET_PAGE_MASK),
3469   - buf, l, is_write);
  3468 + phys_addr += (addr & ~TARGET_PAGE_MASK);
  3469 +#if !defined(CONFIG_USER_ONLY)
  3470 + if (is_write)
  3471 + cpu_physical_memory_write_rom(phys_addr, buf, l);
  3472 + else
  3473 +#endif
  3474 + cpu_physical_memory_rw(phys_addr, buf, l, is_write);
3470 3475 len -= l;
3471 3476 buf += l;
3472 3477 addr += l;
... ...