From patchwork Thu Jul 21 15:16:29 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tsuneo Saito X-Patchwork-Id: 106091 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 07E72B6F18 for ; Fri, 22 Jul 2011 02:13:09 +1000 (EST) Received: from localhost ([::1]:59285 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qjv3J-0002XW-Hg for incoming@patchwork.ozlabs.org; Thu, 21 Jul 2011 11:20:41 -0400 Received: from eggs.gnu.org ([140.186.70.92]:51859) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qjv2a-00018j-CD for qemu-devel@nongnu.org; Thu, 21 Jul 2011 11:20:00 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qjuzz-00032t-1N for qemu-devel@nongnu.org; Thu, 21 Jul 2011 11:17:22 -0400 Received: from mail-pv0-f173.google.com ([74.125.83.173]:57574) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qjuzy-00032g-Sz for qemu-devel@nongnu.org; Thu, 21 Jul 2011 11:17:15 -0400 Received: by pvg3 with SMTP id 3so1492015pvg.4 for ; Thu, 21 Jul 2011 08:17:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references; bh=iKfi0e/DXkRhmFUUwrnj3RJKHy5mQSEKLn73PlFQSpQ=; b=uhgoG+oMqOSrmuvttG7aRKJdHBJvoc1g8QC0ZVRLYhUKtoIjNLr187qwR7UIF+p7Xo rmUA5Wv8XTjEdGNEDUNyLbhGQllO+C4H8fVHUceSqYt/YQfHQlAulqPuO56eaWkBfPpi oeIxVPfnYsFCIRJMafrwIrdmnd8hYka7P2r48= Received: by 10.68.14.195 with SMTP id r3mr460892pbc.171.1311261433675; Thu, 21 Jul 2011 08:17:13 -0700 (PDT) Received: from localhost.localdomain (tetkyo149119.tkyo.te.ftth2.ppp.infoweb.ne.jp [202.219.195.119]) by mx.google.com with ESMTPS id g4sm948229pbj.73.2011.07.21.08.17.12 (version=TLSv1/SSLv3 cipher=OTHER); Thu, 21 Jul 2011 08:17:13 -0700 (PDT) From: Tsuneo Saito To: qemu-devel@nongnu.org Date: Fri, 22 Jul 2011 00:16:29 +0900 Message-Id: <1311261393-47400-4-git-send-email-tsnsaito@gmail.com> X-Mailer: git-send-email 1.7.5.4 In-Reply-To: <1311261393-47400-1-git-send-email-tsnsaito@gmail.com> References: <1311261393-47400-1-git-send-email-tsnsaito@gmail.com> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 74.125.83.173 Cc: Tsuneo Saito Subject: [Qemu-devel] [PATCH 3/7] SPARC64: introduce a convenience function for getting physical addresses 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 Introduce cpu_sparc_get_phys_page() to be used as a help for splitting cpu_get_phys_page_debug() from cpu_get_phys_page_nofault(). Signed-off-by: Tsuneo Saito --- target-sparc/helper.c | 20 ++++++++++++++------ 1 files changed, 14 insertions(+), 6 deletions(-) diff --git a/target-sparc/helper.c b/target-sparc/helper.c index f9b7fe2..9acbcae 100644 --- a/target-sparc/helper.c +++ b/target-sparc/helper.c @@ -736,18 +736,26 @@ void dump_mmu(FILE *f, fprintf_function cpu_fprintf, CPUState *env) #if !defined(CONFIG_USER_ONLY) +static int cpu_sparc_get_phys_page(CPUState *env, target_phys_addr_t *phys, + target_ulong addr, int rw, int mmu_idx) +{ + target_ulong page_size; + int prot, access_index; + + return get_physical_address(env, phys, &prot, &access_index, addr, rw, + mmu_idx, &page_size); +} + target_phys_addr_t cpu_get_phys_page_nofault(CPUState *env, target_ulong addr, int mmu_idx) { target_phys_addr_t phys_addr; - target_ulong page_size; - int prot, access_index; - if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, 2, - mmu_idx, &page_size) != 0) - if (get_physical_address(env, &phys_addr, &prot, &access_index, addr, - 0, mmu_idx, &page_size) != 0) + if (cpu_sparc_get_phys_page(env, &phys_addr, addr, 2, mmu_idx) != 0) { + if (cpu_sparc_get_phys_page(env, &phys_addr, addr, 0, mmu_idx) != 0) { return -1; + } + } if (cpu_get_physical_page_desc(phys_addr) == IO_MEM_UNASSIGNED) return -1; return phys_addr;