From patchwork Wed May 22 13:09:07 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: 245617 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id EA40F2C0091 for ; Wed, 22 May 2013 23:15:15 +1000 (EST) Received: from localhost ([::1]:48480 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8p7-00058n-4Q for incoming@patchwork.ozlabs.org; Wed, 22 May 2013 09:11:21 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45973) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8nD-0002hF-Co for qemu-devel@nongnu.org; Wed, 22 May 2013 09:09:30 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Uf8n6-00050J-Q1 for qemu-devel@nongnu.org; Wed, 22 May 2013 09:09:23 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43066 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8n6-0004zb-En for qemu-devel@nongnu.org; Wed, 22 May 2013 09:09:16 -0400 Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id A8ADCA52D8; Wed, 22 May 2013 15:09:15 +0200 (CEST) From: =?UTF-8?q?Andreas=20F=C3=A4rber?= To: qemu-devel@nongnu.org Date: Wed, 22 May 2013 15:09:07 +0200 Message-Id: <1369228150-5428-3-git-send-email-afaerber@suse.de> X-Mailer: git-send-email 1.8.1.4 In-Reply-To: <1369228150-5428-1-git-send-email-afaerber@suse.de> References: <1369228150-5428-1-git-send-email-afaerber@suse.de> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x X-Received-From: 195.135.220.15 Cc: Jens Freimann , Vincent Rabin , Qiao Nuohan , Paolo Bonzini , =?UTF-8?q?Andreas=20F=C3=A4rber?= Subject: [Qemu-devel] [PATCH qom-cpu 2/4] memory_mapping: Change cpu_get_memory_mapping() argument to CPUState 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 Eliminates an occurrence of CPUArchState from sysemu/memory_mapping.h. Signed-off-by: Andreas Färber --- include/sysemu/memory_mapping.h | 2 +- memory_mapping.c | 2 +- target-i386/arch_memory_mapping.c | 5 ++++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h index 0a418a7..2e2893a 100644 --- a/include/sysemu/memory_mapping.h +++ b/include/sysemu/memory_mapping.h @@ -30,7 +30,7 @@ typedef struct MemoryMappingList { QTAILQ_HEAD(, MemoryMapping) head; } MemoryMappingList; -int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env); +int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *cpu); bool cpu_paging_enabled(CPUArchState *env); /* diff --git a/memory_mapping.c b/memory_mapping.c index 4867ae4..fe8e0ff 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -138,7 +138,7 @@ int qemu_get_guest_memory_mapping(MemoryMappingList *list) first_paging_enabled_cpu = find_paging_enabled_cpu(first_cpu); if (first_paging_enabled_cpu) { for (env = first_paging_enabled_cpu; env != NULL; env = env->next_cpu) { - ret = cpu_get_memory_mapping(list, env); + ret = cpu_get_memory_mapping(list, ENV_GET_CPU(env)); if (ret < 0) { return -1; } diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c index a2eb7e7..187c3df 100644 --- a/target-i386/arch_memory_mapping.c +++ b/target-i386/arch_memory_mapping.c @@ -237,8 +237,11 @@ static void walk_pml4e(MemoryMappingList *list, } #endif -int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) +int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *cs) { + X86CPU *cpu = X86_CPU(cs); + CPUX86State *env = &cpu->env; + if (!cpu_paging_enabled(env)) { /* paging is disabled */ return 0;