From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Ljcvj-00021W-1u for qemu-devel@nongnu.org; Tue, 17 Mar 2009 13:18:19 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Ljcve-00020W-8x for qemu-devel@nongnu.org; Tue, 17 Mar 2009 13:18:18 -0400 Received: from [199.232.76.173] (port=41209 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ljcve-00020R-3f for qemu-devel@nongnu.org; Tue, 17 Mar 2009 13:18:14 -0400 Received: from lizzard.sbs.de ([194.138.37.39]:16122) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Ljcvd-0003l9-Jj for qemu-devel@nongnu.org; Tue, 17 Mar 2009 13:18:13 -0400 Received: from mail2.sbs.de (localhost [127.0.0.1]) by lizzard.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id n2HHIBxB017777 for ; Tue, 17 Mar 2009 18:18:11 +0100 Received: from [139.25.109.167] (mchn012c.ww002.siemens.net [139.25.109.167] (may be forged)) by mail2.sbs.de (8.12.11.20060308/8.12.11) with ESMTP id n2HHIBlJ002316 for ; Tue, 17 Mar 2009 18:18:11 +0100 Message-ID: <49BFDB53.9020004@siemens.com> Date: Tue, 17 Mar 2009 18:18:11 +0100 From: Jan Kiszka MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: 7bit Subject: [Qemu-devel] [PATCH 1/2] ROM write access for debugging Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel 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 --- exec.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/exec.c b/exec.c index 86ab7de..5e94a8f 100644 --- a/exec.c +++ b/exec.c @@ -3448,7 +3448,7 @@ void stq_phys(target_phys_addr_t addr, uint64_t val) #endif -/* virtual memory access for debug */ +/* virtual memory access for debug (includes writing to ROM) */ int cpu_memory_rw_debug(CPUState *env, target_ulong addr, uint8_t *buf, int len, int is_write) { @@ -3465,8 +3465,13 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong addr, 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); + phys_addr += (addr & ~TARGET_PAGE_MASK); +#if !defined(CONFIG_USER_ONLY) + if (is_write) + cpu_physical_memory_write_rom(phys_addr, buf, l); + else +#endif + cpu_physical_memory_rw(phys_addr, buf, l, is_write); len -= l; buf += l; addr += l;