diff options
author | Andreas Färber <afaerber@suse.de> | 2013-05-28 13:52:01 +0200 |
---|---|---|
committer | Andreas Färber <afaerber@suse.de> | 2013-06-11 18:03:35 +0200 |
commit | a23bbfda75118eb738acce84afd64965934828f0 (patch) | |
tree | 657bf51b76711385cea7df8464d32bf7bd620f84 /target-i386 | |
parent | 6d4d3ae77dbb756d454c2deb2ef844b0cc7bde7b (diff) | |
download | qemu-a23bbfda75118eb738acce84afd64965934828f0.tar.gz qemu-a23bbfda75118eb738acce84afd64965934828f0.tar.bz2 qemu-a23bbfda75118eb738acce84afd64965934828f0.zip |
cpu: Turn cpu_get_memory_mapping() into a CPUState hook
Change error reporting from return value to Error argument.
Reviewed-by: Jens Freimann <jfrei@linux.vnet.ibm.com>
Reviewed-by: Luiz Capitulino <lcapitulino@redhat.com>
[AF: Fixed cpu_get_memory_mapping() documentation]
Signed-off-by: Andreas Färber <afaerber@suse.de>
Diffstat (limited to 'target-i386')
-rw-r--r-- | target-i386/arch_memory_mapping.c | 12 | ||||
-rw-r--r-- | target-i386/cpu-qom.h | 3 | ||||
-rw-r--r-- | target-i386/cpu.c | 1 |
3 files changed, 11 insertions, 5 deletions
diff --git a/target-i386/arch_memory_mapping.c b/target-i386/arch_memory_mapping.c index c5a10ec9bd..2566a040a6 100644 --- a/target-i386/arch_memory_mapping.c +++ b/target-i386/arch_memory_mapping.c @@ -239,11 +239,15 @@ static void walk_pml4e(MemoryMappingList *list, } #endif -int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) +void x86_cpu_get_memory_mapping(CPUState *cs, MemoryMappingList *list, + Error **errp) { - if (!cpu_paging_enabled(ENV_GET_CPU(env))) { + X86CPU *cpu = X86_CPU(cs); + CPUX86State *env = &cpu->env; + + if (!cpu_paging_enabled(cs)) { /* paging is disabled */ - return 0; + return; } if (env->cr[4] & CR4_PAE_MASK) { @@ -269,7 +273,5 @@ int cpu_get_memory_mapping(MemoryMappingList *list, CPUArchState *env) pse = !!(env->cr[4] & CR4_PSE_MASK); walk_pde2(list, pde_addr, env->a20_mask, pse); } - - return 0; } diff --git a/target-i386/cpu-qom.h b/target-i386/cpu-qom.h index 849cedf94c..e0ac072c5f 100644 --- a/target-i386/cpu-qom.h +++ b/target-i386/cpu-qom.h @@ -98,4 +98,7 @@ int x86_cpu_write_elf64_qemunote(WriteCoreDumpFunction f, CPUState *cpu, int x86_cpu_write_elf32_qemunote(WriteCoreDumpFunction f, CPUState *cpu, void *opaque); +void x86_cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list, + Error **errp); + #endif diff --git a/target-i386/cpu.c b/target-i386/cpu.c index f6fa7fa8b6..a7154af11d 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -2529,6 +2529,7 @@ static void x86_cpu_common_class_init(ObjectClass *oc, void *data) cc->get_arch_id = x86_cpu_get_arch_id; cc->get_paging_enabled = x86_cpu_get_paging_enabled; #ifndef CONFIG_USER_ONLY + cc->get_memory_mapping = x86_cpu_get_memory_mapping; cc->write_elf64_note = x86_cpu_write_elf64_note; cc->write_elf64_qemunote = x86_cpu_write_elf64_qemunote; cc->write_elf32_note = x86_cpu_write_elf32_note; |