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>
This commit is contained in:
Andreas Färber 2013-05-28 13:52:01 +02:00
parent 6d4d3ae77d
commit a23bbfda75
8 changed files with 44 additions and 16 deletions

View file

@ -23,6 +23,7 @@
#include <signal.h>
#include "hw/qdev-core.h"
#include "qemu/thread.h"
#include "qemu/typedefs.h"
typedef int (*WriteCoreDumpFunction)(void *buf, size_t size, void *opaque);
@ -49,6 +50,7 @@ typedef struct CPUState CPUState;
* @do_interrupt: Callback for interrupt handling.
* @get_arch_id: Callback for getting architecture-dependent CPU ID.
* @get_paging_enabled: Callback for inquiring whether paging is enabled.
* @get_memory_mapping: Callback for obtaining the memory mappings.
* @vmsd: State description for migration.
*
* Represents a CPU family or model.
@ -64,6 +66,8 @@ typedef struct CPUClass {
void (*do_interrupt)(CPUState *cpu);
int64_t (*get_arch_id)(CPUState *cpu);
bool (*get_paging_enabled)(const CPUState *cpu);
void (*get_memory_mapping)(CPUState *cpu, MemoryMappingList *list,
Error **errp);
const struct VMStateDescription *vmsd;
int (*write_elf64_note)(WriteCoreDumpFunction f, CPUState *cpu,
@ -147,6 +151,15 @@ struct CPUState {
*/
bool cpu_paging_enabled(const CPUState *cpu);
/**
* cpu_get_memory_mapping:
* @cpu: The CPU whose memory mappings are to be obtained.
* @list: Where to write the memory mappings to.
* @errp: Pointer for reporting an #Error.
*/
void cpu_get_memory_mapping(CPUState *cpu, MemoryMappingList *list,
Error **errp);
/**
* cpu_write_elf64_note:
* @f: pointer to a function that writes memory to a file