From patchwork Sun Apr 22 15:35:17 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Blue Swirl X-Patchwork-Id: 154291 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 7F92EB6FAA for ; Mon, 23 Apr 2012 01:36:32 +1000 (EST) Received: from localhost ([::1]:52989 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLypy-0006Sc-A1 for incoming@patchwork.ozlabs.org; Sun, 22 Apr 2012 11:36:30 -0400 Received: from eggs.gnu.org ([208.118.235.92]:46977) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLypA-0004ZB-EJ for qemu-devel@nongnu.org; Sun, 22 Apr 2012 11:35:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SLyp8-000327-Ls for qemu-devel@nongnu.org; Sun, 22 Apr 2012 11:35:40 -0400 Received: from mail-iy0-f173.google.com ([209.85.210.173]:45591) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SLyp8-0002rD-EG for qemu-devel@nongnu.org; Sun, 22 Apr 2012 11:35:38 -0400 Received: by mail-iy0-f173.google.com with SMTP id j26so18159143iaf.4 for ; Sun, 22 Apr 2012 08:35:37 -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=ERi4fZPNfy8CPKMKvqvgShLX32m7eN772LgKNbEajSU=; b=dHSn+f/wfY2zmbMkRaPRGRFmvU/wIK1Khwm9a17S8nueLz6pzNuWqQWp03/uuU70MH zXK1YZHUSqH7NNrGMgsG+jJHnLKf/nJjfPRDwXwP/dRpP6rFuHphHByxxaa352cf5+E8 GSPVXwEBK5u4H+Q1bBGjv0NmBZ+yq1aUGJ4M/sxLEWNA1jPB/VVV7JNa6lZxKAHkovwm CdxKDOH0rPj/d5q3U6QLPG2bMTTQ5fJ3DMwljf4ks93Uvx8N29nFkWsfXdDInIzs/MT6 hO996JBZRo3bHr628hdA3dYCwgwDK+mSWjEtmqMM43IRMiX8JGpiY1S3Gkwxns1LwgyE ElpA== Received: by 10.50.212.97 with SMTP id nj1mr4082054igc.65.1335108937677; Sun, 22 Apr 2012 08:35:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.50.197.194 with HTTP; Sun, 22 Apr 2012 08:35:17 -0700 (PDT) From: Blue Swirl Date: Sun, 22 Apr 2012 15:35:17 +0000 Message-ID: To: Avi Kivity , Richard Henderson , 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 4/4] 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 Reviewed-by: Richard Henderson --- 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 62d4140..0607c9b 100644 --- a/exec.c +++ b/exec.c @@ -503,14 +503,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