From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:47497) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7dau-00038U-GB for qemu-devel@nongnu.org; Tue, 13 Mar 2012 22:05:41 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1S7daa-0006aL-Ee for qemu-devel@nongnu.org; Tue, 13 Mar 2012 22:05:40 -0400 Received: from [222.73.24.84] (port=18500 helo=song.cn.fujitsu.com) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1S7daa-0006ZX-3W for qemu-devel@nongnu.org; Tue, 13 Mar 2012 22:05:20 -0400 Message-ID: <4F5FFD4F.2070406@cn.fujitsu.com> Date: Wed, 14 Mar 2012 10:07:11 +0800 From: Wen Congyang MIME-Version: 1.0 References: <4F5FFC63.3060300@cn.fujitsu.com> In-Reply-To: <4F5FFC63.3060300@cn.fujitsu.com> Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=ISO-8859-1 Subject: [Qemu-devel] [RFC][PATCH 04/14 v9] Add API to check whether paging mode is enabled List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel , Jan Kiszka , Dave Anderson , HATAYAMA Daisuke , Luiz Capitulino , Eric Blake 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 786dbea..4fe7174 100644 --- a/cpu-all.h +++ b/cpu-all.h @@ -519,11 +519,17 @@ int cpu_memory_rw_debug(CPUState *env, target_ulong addr, #if defined(CONFIG_HAVE_GET_MEMORY_MAPPING) int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *env); +bool cpu_paging_enabled(CPUState *env); #else static inline int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *env) { return -1; } + +static inline bool cpu_paging_enabled(CPUState *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 10d9b2c..824f293 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, CPUState *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, CPUState *env) return 0; } + +bool cpu_paging_enabled(CPUState *env) +{ + return env->cr[0] & CR0_PG_MASK; +} -- 1.7.1