From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jan Kiszka Subject: Re: [PATCH] kvm-userspace: x86: Support for breakpoints in ROM code Date: Tue, 17 Mar 2009 11:43:03 +0100 Message-ID: <49BF7EB7.4060603@siemens.com> References: <49BE9EF7.7010005@siemens.com> <49BEA02A.1070909@siemens.com> <49BF6E75.1070802@redhat.com> <49BF7109.5000207@siemens.com> <49BF72B6.4040907@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Cc: kvm-devel To: Avi Kivity Return-path: Received: from gecko.sbs.de ([194.138.37.40]:18995 "EHLO gecko.sbs.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755361AbZCQKnW (ORCPT ); Tue, 17 Mar 2009 06:43:22 -0400 In-Reply-To: <49BF72B6.4040907@redhat.com> Sender: kvm-owner@vger.kernel.org List-ID: Avi Kivity wrote: > Jan Kiszka wrote: >> This is not a hack (it shouldn't have been merged upstream otherwise): >> cpu_physical_memory_write_rom() takes system-wide physical addresses >> while kvm_patch_opcode_byte() works with per-CPU linear addresses. >> > > From exec.c: > >> /* virtual memory access for debug */ >> int cpu_memory_rw_debug(CPUState *env, target_ulong addr, >> uint8_t *buf, int len, int is_write) >> { >> int l; >> target_phys_addr_t phys_addr; >> target_ulong page; >> >> while (len > 0) { >> page = addr & TARGET_PAGE_MASK; >> phys_addr = cpu_get_phys_page_debug(env, page); >> /* if no physical page mapped, return an error */ >> if (phys_addr == -1) >> return -1; >> l = (page + TARGET_PAGE_SIZE) - addr; >> if (l > len) >> l = len; >> cpu_physical_memory_rw(phys_addr + (addr & ~TARGET_PAGE_MASK), >> buf, l, is_write); >> len -= l; >> buf += l; >> addr += l; >> } >> return 0; >> } > > I'm talking about replacing cpu_physical_memory_rw() with > cpu_physical_memory_write_rom() (for the write case). Ah, miss-read your point. > Is there a case > where the debugger should be prevented from writing into ROM? If so, > maybe cpu_memory_rw_debug_rom() for breakpoints? Good and valid question. So far only the 'M' gdb packet uses cpu_physical_memory_rw in write mode, and I don't know if there is any reason to deny modifying ROM code that way. Hmm, will check with upstream and change there first. So forget about this patch for now. Jan -- Siemens AG, Corporate Technology, CT SE 2 Corporate Competence Center Embedded Linux