From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:40072) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRF9d-0008NA-Q7 for qemu-devel@nongnu.org; Mon, 07 May 2012 00:02:35 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SRF9c-0007E9-0w for qemu-devel@nongnu.org; Mon, 07 May 2012 00:02:33 -0400 Received: from [222.73.24.84] (port=18475 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SRF9b-0007Dt-LB for qemu-devel@nongnu.org; Mon, 07 May 2012 00:02:31 -0400 Message-ID: <4FA74A16.3080604@cn.fujitsu.com> Date: Mon, 07 May 2012 12:05:42 +0800 From: Wen Congyang MIME-Version: 1.0 References: <4FA74927.5070905@cn.fujitsu.com> In-Reply-To: <4FA74927.5070905@cn.fujitsu.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] [PATCH 04/12 v15] Add API to check whether paging mode is enabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , HATAYAMA Daisuke , Luiz Capitulino , "Daniel P. Berrange" , Anthony Liguori This API will be used in the following patch. Signed-off-by: Wen Congyang --- cpu-all.h | 6 ++++++ target-i386/arch_memory_mapping.c | 7 ++++++- 2 files changed, 12 insertions(+), 1 deletions(-) diff --git a/cpu-all.h b/cpu-all.h index 2688bac..76439b4 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -527,12 +527,18 @@ int cpu_memory_rw_debug(CPUArchState *env, target_ulong addr, #if defined(CONFIG_HAVE_GET_MEMORY_MAPPING) int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env); +bool cpu_paging_enabled(CPUArchState *env); #else static inline int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) { return -1; } + +static inline bool cpu_paging_enabled(CPUArchState *env) +{ + return true; +} #endif #endif /* CPU_ALL_H */ diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c index dd64bec..bd50e11 100644 --- a/target-i386/arch_memory_mapping.c +++ b/target-i386/arch_memory_mapping.c @@ -233,7 +233,7 @@ static void walk_pml4e(MemoryMappingList *list, int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) { - if (!(env->cr[0] & CR0_PG_MASK)) { + if (!cpu_paging_enabled(env)) { /* paging is disabled */ return 0; } @@ -264,3 +264,8 @@ int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) return 0; } + +bool cpu_paging_enabled(CPUArchState *env) +{ + return env->cr[0] & CR0_PG_MASK; +} -- 1.7.1