From patchwork Sat Jul 6 20:19:18 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Andreas_F=C3=A4rber?= X-Patchwork-Id: 257300 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 3C4CF2C0099 for ; Sun, 7 Jul 2013 06:24:58 +1000 (EST) Received: from localhost ([::1]:51605 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvZ2K-0007BG-TP for incoming@patchwork.ozlabs.org; Sat, 06 Jul 2013 16:24:52 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:37035) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvZ24-0007B8-7S for qemu-devel@nongnu.org; Sat, 06 Jul 2013 16:24:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UvYx4-0003Jp-1q for qemu-devel@nongnu.org; Sat, 06 Jul 2013 16:19:38 -0400 Received: from cantor2.suse.de ([195.135.220.15]:36260 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UvYx3-0003JO-KJ; Sat, 06 Jul 2013 16:19:25 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 24A47A51B7; Sat, 6 Jul 2013 22:19:23 +0200 (CEST) Message-ID: <51D87BC6.2090600@suse.de> Date: Sat, 06 Jul 2013 22:19:18 +0200 From: =?UTF-8?B?QW5kcmVhcyBGw6RyYmVy?= Organization: SUSE LINUX Products GmbH User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130620 Thunderbird/17.0.7 MIME-Version: 1.0 To: Max Filippov References: <1372536117-28167-1-git-send-email-afaerber@suse.de> <1372536117-28167-34-git-send-email-afaerber@suse.de> In-Reply-To: <1372536117-28167-34-git-send-email-afaerber@suse.de> X-Enigmail-Version: 1.6a1pre X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Peter Maydell , Anthony Green , qemu-devel@nongnu.org, Alexander Graf , Blue Swirl , Michael Walle , qemu-ppc , Paul Brook , "Edgar E. Iglesias" , jan.kiszka@web.de, Guan Xuetao , Aurelien Jarno , Richard Henderson Subject: Re: [Qemu-devel] [PATCH RFC qom-cpu 33/41] cpu: Turn cpu_get_phys_page_debug() into a CPUClass hook X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Am 29.06.2013 22:01, schrieb Andreas Färber: > Since all targets now assign a softmmu-only field, we can drop helpers > cpu_class_set_{do_unassigned_access,vmsd}() and device_class_set_vmsd(). > > Prepares for changing cpu_memory_rw_debug() argument to CPUState. > > Signed-off-by: Andreas Färber The following fixup for xtensa is required. This demonstrates how dangerous it is to pass void* arguments directly into functions - please always use a typed local variable to enforce type checks. Andreas Acked-by: Max Filippov diff --git a/hw/xtensa/xtensa_lx60.c b/hw/xtensa/xtensa_lx60.c index 650dd31..a079774 100644 --- a/hw/xtensa/xtensa_lx60.c +++ b/hw/xtensa/xtensa_lx60.c @@ -144,9 +144,11 @@ static void lx60_net_init(MemoryRegion *address_space, memory_region_add_subregion(address_space, buffers, ram); } -static uint64_t translate_phys_addr(void *env, uint64_t addr) +static uint64_t translate_phys_addr(void *opaque, uint64_t addr) { - return cpu_get_phys_page_debug(env, addr); + XtensaCPU *cpu = opaque; + + return cpu_get_phys_page_debug(CPU(cpu), addr); } static void lx60_reset(void *opaque) @@ -252,7 +254,7 @@ static void lx_init(const LxBoardDesc *board, QEMUMachineInitArgs *args) } uint64_t elf_entry; uint64_t elf_lowaddr; - int success = load_elf(kernel_filename, translate_phys_addr, env, + int success = load_elf(kernel_filename, translate_phys_addr, cpu, &elf_entry, &elf_lowaddr, NULL, be, ELF_MACHINE, 0); if (success > 0) { env->pc = elf_entry; diff --git a/hw/xtensa/xtensa_sim.c b/hw/xtensa/xtensa_sim.c index 5241f8d..a4194cfb 100644 --- a/hw/xtensa/xtensa_sim.c +++ b/hw/xtensa/xtensa_sim.c @@ -32,9 +32,11 @@ #include "exec/memory.h" #include "exec/address-spaces.h" -static uint64_t translate_phys_addr(void *env, uint64_t addr) +static uint64_t translate_phys_addr(void *opaque, uint64_t addr) { - return cpu_get_phys_page_debug(env, addr); + XtensaCPU *cpu = opaque; + + return cpu_get_phys_page_debug(CPU(cpu), addr); } static void sim_reset(void *opaque) @@ -88,10 +90,10 @@ static void xtensa_sim_init(QEMUMachineInitArgs *args) uint64_t elf_entry; uint64_t elf_lowaddr; #ifdef TARGET_WORDS_BIGENDIAN - int success = load_elf(kernel_filename, translate_phys_addr, env, + int success = load_elf(kernel_filename, translate_phys_addr, cpu, &elf_entry, &elf_lowaddr, NULL, 1, ELF_MACHINE, 0); #else - int success = load_elf(kernel_filename, translate_phys_addr, env, + int success = load_elf(kernel_filename, translate_phys_addr, cpu, &elf_entry, &elf_lowaddr, NULL, 0, ELF_MACHINE, 0); #endif if (success > 0) {