handle some errors properly so avoid exit() during initialization. this fixes issue #237

This commit is contained in:
Nguyen Anh Quynh
2015-11-12 01:43:41 +08:00
parent 116d96692d
commit 2f297bdd3a
38 changed files with 203 additions and 125 deletions

View File

@ -9,7 +9,7 @@
#include "qom/object.h"
#include "uc_priv.h"
typedef void QEMUMachineInitFunc(struct uc_struct *uc, MachineState *ms);
typedef int QEMUMachineInitFunc(struct uc_struct *uc, MachineState *ms);
typedef void QEMUMachineResetFunc(void);
@ -54,7 +54,7 @@ struct MachineClass {
const char *family; /* NULL iff @name identifies a standalone machtype */
const char *name;
void (*init)(struct uc_struct *uc, MachineState *state);
int (*init)(struct uc_struct *uc, MachineState *state);
void (*reset)(void);
int max_cpus;

View File

@ -34,7 +34,7 @@ typedef struct PCMachineClass PCMachineClass;
#define PC_MACHINE_CLASS(klass) \
OBJECT_CLASS_CHECK(PCMachineClass, (klass), TYPE_PC_MACHINE)
void pc_cpus_init(struct uc_struct *uc, const char *cpu_model);
int pc_cpus_init(struct uc_struct *uc, const char *cpu_model);
FWCfgState *pc_memory_init(MachineState *machine,
MemoryRegion *system_memory,

View File

@ -32,7 +32,7 @@ typedef enum DeviceCategory {
typedef int (*qdev_initfn)(DeviceState *dev);
typedef int (*qdev_event)(DeviceState *dev);
typedef void (*qdev_resetfn)(DeviceState *dev);
typedef void (*DeviceRealize)(struct uc_struct *uc, DeviceState *dev, Error **errp);
typedef int (*DeviceRealize)(struct uc_struct *uc, DeviceState *dev, Error **errp);
typedef void (*DeviceUnrealize)(DeviceState *dev, Error **errp);
typedef void (*BusRealize)(BusState *bus, Error **errp);
typedef void (*BusUnrealize)(BusState *bus, Error **errp);