From patchwork Sat Apr 14 15:24:08 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 152515 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 AB98CB6FEA for ; Sun, 15 Apr 2012 01:24:50 +1000 (EST) Received: from localhost ([::1]:42032 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJ4qG-0000JJ-HM for incoming@patchwork.ozlabs.org; Sat, 14 Apr 2012 11:24:48 -0400 Received: from eggs.gnu.org ([208.118.235.92]:54111) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJ4q2-00007Q-1Z for qemu-devel@nongnu.org; Sat, 14 Apr 2012 11:24:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SJ4px-000585-WD for qemu-devel@nongnu.org; Sat, 14 Apr 2012 11:24:33 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:37864) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SJ4px-0004jo-Oj for qemu-devel@nongnu.org; Sat, 14 Apr 2012 11:24:29 -0400 Received: by mail-iy0-f173.google.com with SMTP id j26so6373014iaf.4 for ; Sat, 14 Apr 2012 08:24:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:from:date:message-id:subject:to:content-type; bh=QL+nCDs86Cf2L1G3zcn5HMl9eGBiH1hmIj52t1xK5x8=; b=ZJElnjtCOY+EJuo5u+B1pdpNYWKi42lmxSdL5rV7JkddH778mVcuE4Z6fIuEvyAB/n R8kwIJqD4VkMZHD7743dyddnfZJ9xeUO4rD3xQyt+Gzf6t+XJ+XrkRs4y6gMLN1UPRDm c8trLVkTmgVpozcIyq2RessUWYDIfG4nOAZtpEHoYqY8DlyU3IfBmCZZOXbmzYKXFskq Y9msh/NvD6MzVmPI8cX/TggNc/guUudVe/v5aqVagTX9Bbi0u50D5wPEzbwPlk6OoqIL CvD7yHH+RSYrZ2cegEcC3Rmm4lWWouF+0p8IHrE30coBLwCwZj/pZGMmeKGbGEGo0cuN 98qg== Received: by 10.42.155.9 with SMTP id s9mr3379363icw.51.1334417068990; Sat, 14 Apr 2012 08:24:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.197.194 with HTTP; Sat, 14 Apr 2012 08:24:08 -0700 (PDT) From: Blue Swirl Date: Sat, 14 Apr 2012 15:24:08 +0000 Message-ID: To: Avi Kivity , qemu-devel X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 209.85.210.173 Subject: [Qemu-devel] [PATCH 3/3] memory: move functions is_romd and section_addr to memory API 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 Signed-off-by: Blue Swirl --- cputlb.h | 6 ------ exec.c | 8 -------- memory.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 14 deletions(-) From dd901d0eac685234b4fa23376ae8702076836e3e Mon Sep 17 00:00:00 2001 Message-Id: In-Reply-To: References: From: Blue Swirl Date: Mon, 9 Apr 2012 17:38:52 +0000 Subject: [PATCH 3/3] memory: move functions is_romd and section_addr to memory API Signed-off-by: Blue Swirl --- cputlb.h | 6 ------ exec.c | 8 -------- memory.h | 29 +++++++++++++++++++++++++++++ 3 files changed, 29 insertions(+), 14 deletions(-) diff --git a/cputlb.h b/cputlb.h index 60479af..ce6e297 100644 --- a/cputlb.h +++ b/cputlb.h @@ -32,8 +32,6 @@ void tlb_set_dirty(CPUArchState *env, target_ulong vaddr); extern int tlb_flush_count; /* exec.c */ -target_phys_addr_t memory_region_section_addr(MemoryRegionSection *section, - target_phys_addr_t addr); void tb_flush_jmp_cache(CPUArchState *env, target_ulong addr); target_phys_addr_t memory_region_section_get_iotlb(CPUArchState *env, MemoryRegionSection *section, @@ -43,9 +41,5 @@ target_phys_addr_t memory_region_section_get_iotlb(CPUArchState *env, target_ulong *address); bool memory_region_is_unassigned(MemoryRegion *mr); -static inline bool memory_region_is_romd(MemoryRegion *mr) -{ - return mr->rom_device && mr->readable; -} #endif #endif diff --git a/exec.c b/exec.c index b137c54..5ffb5b4 100644 --- a/exec.c +++ b/exec.c @@ -550,14 +550,6 @@ bool memory_region_is_unassigned(MemoryRegion *mr) && mr != &io_mem_watch; } -target_phys_addr_t memory_region_section_addr(MemoryRegionSection *section, - target_phys_addr_t addr) -{ - addr -= section->offset_within_address_space; - addr += section->offset_within_region; - return addr; -} - #define mmap_lock() do { } while(0) #define mmap_unlock() do { } while(0) #endif diff --git a/memory.h b/memory.h index 53ff62b..740c48e 100644 --- a/memory.h +++ b/memory.h @@ -339,6 +339,19 @@ uint64_t memory_region_size(MemoryRegion *mr); bool memory_region_is_ram(MemoryRegion *mr); /** + * memory_region_is_romd: check whether a memory region is ROMD + * + * Returns %true is a memory region is ROMD and currently set to allow + * direct reads. + * + * @mr: the memory region being queried + */ +static inline bool memory_region_is_romd(MemoryRegion *mr) +{ + return mr->rom_device && mr->readable; +} + +/** * memory_region_name: get a memory region's name * * Returns the string that was used to initialize the memory region. @@ -666,6 +679,22 @@ void memory_region_set_alias_offset(MemoryRegion *mr, MemoryRegionSection memory_region_find(MemoryRegion *address_space, target_phys_addr_t addr, uint64_t size); +/** + * memory_region_section_addr: get offset within MemoryRegionSection + * + * Returns offset within MemoryRegionSection + * + * @section: the memory region section being queried + * @addr: address in address space + */ +static inline target_phys_addr_t +memory_region_section_addr(MemoryRegionSection *section, + target_phys_addr_t addr) +{ + addr -= section->offset_within_address_space; + addr += section->offset_within_region; + return addr; +} /** * memory_global_sync_dirty_bitmap: synchronize the dirty log for all memory -- 1.7.2.5