From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:60154) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1RcveF-0007Yg-92 for qemu-devel@nongnu.org; Tue, 20 Dec 2011 04:06:15 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Rcve9-0002FX-I6 for qemu-devel@nongnu.org; Tue, 20 Dec 2011 04:06:11 -0500 Received: from [222.73.24.84] (port=63356 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Rcve8-0002FP-Q6 for qemu-devel@nongnu.org; Tue, 20 Dec 2011 04:06:05 -0500 Message-ID: <4EF050B0.6070104@cn.fujitsu.com> Date: Tue, 20 Dec 2011 17:09:04 +0800 From: Wen Congyang MIME-Version: 1.0 References: <4EF04D58.3030900@cn.fujitsu.com> In-Reply-To: <4EF04D58.3030900@cn.fujitsu.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] [RFC][PATCH 2/8 v3] Add API to check whether a physical address is I/O address List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Jan Kiszka , Dave Anderson , HATAYAMA Daisuke This API will be used in the following patch. Signed-off-by: Wen Congyang --- cpu-common.h | 1 + exec.c | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 0 deletions(-) diff --git a/cpu-common.h b/cpu-common.h index 8295e4f..75c01c3 100644 --- a/cpu-common.h +++ b/cpu-common.h @@ -91,6 +91,7 @@ struct CPUPhysMemoryClient { QLIST_ENTRY(CPUPhysMemoryClient) list; }; +bool is_io_addr(target_phys_addr_t phys_addr); void cpu_register_phys_memory_client(CPUPhysMemoryClient *); void cpu_unregister_phys_memory_client(CPUPhysMemoryClient *); diff --git a/exec.c b/exec.c index 32782b4..cf0ae8b 100644 --- a/exec.c +++ b/exec.c @@ -4853,3 +4853,23 @@ void dump_exec_info(FILE *f, fprintf_function cpu_fprintf) #undef env #endif + +bool is_io_addr(target_phys_addr_t phys_addr) +{ + ram_addr_t pd; + PhysPageDesc *p; + + p = phys_page_find(phys_addr >> TARGET_PAGE_BITS); + if (!p) { + pd = IO_MEM_UNASSIGNED; + } else { + pd = p->phys_offset; + } + + if ((pd & ~TARGET_PAGE_MASK) > IO_MEM_ROM && !(pd & IO_MEM_ROMD)) { + /* I/O region */ + return true; + } + + return false; +} -- 1.7.1