From patchwork Wed May 22 13:09:08 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: 245611 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 243162C0099 for ; Wed, 22 May 2013 23:10:02 +1000 (EST) Received: from localhost ([::1]:44380 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8no-0002kB-87 for incoming@patchwork.ozlabs.org; Wed, 22 May 2013 09:10:00 -0400 Received: from eggs.gnu.org ([208.118.235.92]:45971) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8nD-0002hE-8m 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-000509-Ol for qemu-devel@nongnu.org; Wed, 22 May 2013 09:09:23 -0400 Received: from cantor2.suse.de ([195.135.220.15]:43069 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Uf8n6-0004zd-ET for qemu-devel@nongnu.org; Wed, 22 May 2013 09:09:16 -0400 Received: from relay1.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id D18A6A52D9; 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:08 +0200 Message-Id: <1369228150-5428-4-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 3/4] memory_mapping: Change cpu_paging_enabled() 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 Removes the last 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 | 7 +++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h index 2e2893a..bfffb6b 100644 --- a/include/sysemu/memory_mapping.h +++ b/include/sysemu/memory_mapping.h @@ -31,7 +31,7 @@ typedef struct MemoryMappingList { } MemoryMappingList; int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *cpu); -bool cpu_paging_enabled(CPUArchState *env); +bool cpu_paging_enabled(CPUState *cpu); /* * add or merge the memory region [phys_addr, phys_addr + length) into the diff --git a/memory_mapping.c b/memory_mapping.c index fe8e0ff..8d14ed8 100644 --- a/memory_mapping.c +++ b/memory_mapping.c @@ -120,7 +120,7 @@ static CPUArchState *find_paging_enabled_cpu(CPUArchState *start_cpu) CPUArchState *env; for (env = start_cpu; env != NULL; env = env->next_cpu) { - if (cpu_paging_enabled(env)) { + if (cpu_paging_enabled(ENV_GET_CPU(env))) { return env; } } diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c index 187c3df..44ed886 100644 --- a/target-i386/arch_memory_mapping.c +++ b/target-i386/arch_memory_mapping.c @@ -242,7 +242,7 @@ int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *cs) X86CPU *cpu = X86_CPU(cs); CPUX86State *env = &cpu->env; - if (!cpu_paging_enabled(env)) { + if (!cpu_paging_enabled(cs)) { /* paging is disabled */ return 0; } @@ -274,7 +274,10 @@ int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *cs) return 0; } -bool cpu_paging_enabled(CPUArchState *env) +bool cpu_paging_enabled(CPUState *cs) { + X86CPU *cpu = X86_CPU(cs); + CPUX86State *env = &cpu->env; + return env->cr[0] & CR0_PG_MASK; }