Patchwork [qom-cpu,3/4] memory_mapping: Change cpu_paging_enabled() argument to CPUState

login
register
mail settings
Submitter Andreas Färber
Date May 22, 2013, 1:09 p.m.
Message ID <1369228150-5428-4-git-send-email-afaerber@suse.de>
Download mbox | patch
Permalink /patch/245611/
State New
Headers show

Comments

Andreas Färber - May 22, 2013, 1:09 p.m.
Removes the last occurrence of CPUArchState from sysemu/memory_mapping.h.

Signed-off-by: Andreas Färber <afaerber@suse.de>
---
 include/sysemu/memory_mapping.h   | 2 +-
 memory_mapping.c                  | 2 +-
 target-i386/arch_memory_mapping.c | 7 +++++--
 3 files changed, 7 insertions(+), 4 deletions(-)

Patch

diff --git a/include/sysemu/memory_mapping.h b/include/sysemu/memory_mapping.h
index 2e2893a..bfffb6b 100644
--- a/include/sysemu/memory_mapping.h
+++ b/include/sysemu/memory_mapping.h
@@ -31,7 +31,7 @@  typedef struct MemoryMappingList {
 } MemoryMappingList;
 
 int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *cpu);
-bool cpu_paging_enabled(CPUArchState *env);
+bool cpu_paging_enabled(CPUState *cpu);
 
 /*
  * add or merge the memory region [phys_addr, phys_addr + length) into the
diff --git a/memory_mapping.c b/memory_mapping.c
index fe8e0ff..8d14ed8 100644
--- a/memory_mapping.c
+++ b/memory_mapping.c
@@ -120,7 +120,7 @@  static CPUArchState *find_paging_enabled_cpu(CPUArchState *start_cpu)
     CPUArchState *env;
 
     for (env = start_cpu; env != NULL; env = env->next_cpu) {
-        if (cpu_paging_enabled(env)) {
+        if (cpu_paging_enabled(ENV_GET_CPU(env))) {
             return env;
         }
     }
diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c
index 187c3df..44ed886 100644
--- a/target-i386/arch_memory_mapping.c
+++ b/target-i386/arch_memory_mapping.c
@@ -242,7 +242,7 @@  int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *cs)
     X86CPU *cpu = X86_CPU(cs);
     CPUX86State *env = &cpu->env;
 
-    if (!cpu_paging_enabled(env)) {
+    if (!cpu_paging_enabled(cs)) {
         /* paging is disabled */
         return 0;
     }
@@ -274,7 +274,10 @@  int cpu_get_memory_mapping(MemoryMappingList *list, CPUState *cs)
     return 0;
 }
 
-bool cpu_paging_enabled(CPUArchState *env)
+bool cpu_paging_enabled(CPUState *cs)
 {
+    X86CPU *cpu = X86_CPU(cs);
+    CPUX86State *env = &cpu->env;
+
     return env->cr[0] & CR0_PG_MASK;
 }