[<<][arm][>>][..]
Sun Nov 24 10:23:47 EST 2013

qemu primer

- modules are registered through init functions defined in module.h :

#define block_init(function) module_init(function, MODULE_INIT_BLOCK)
#define machine_init(function) module_init(function, MODULE_INIT_MACHINE)
#define qapi_init(function) module_init(function, MODULE_INIT_QAPI)
#define type_init(function) module_init(function, MODULE_INIT_QOM)

Probably best to start reading here:

http://qemu.weilnetz.de/qemu-tech.html
http://wiki.qemu.org/Documentation/GettingStartedDevelopers


Starting from the CC32RS512 diff, it might be good to add a memory
mapped I/O for debug output.  This would give a good idea of how
virtual devices work.

Relevant calls/macros for the CC32 SYSC emulation:

type_init(cc32_register_types)
type_register_static(&cc32_sysc_info);
cc32_sysc_class_init()
DEVICE_CLASS()
SYS_BUS_DEVICE_CLASS()
cc32_sysc_init
cc32_sysc_reset
FROM_SYSBUS()
qdev_init_gpio_in()
sysbus_init_irq()
memory_region_init_io()
sysbus_init_mmio()
container_of()
sysbus_create_varargs() / sysbus_create_simple()



Datastructures first.

static void cc32_sysc_reset(DeviceState *d) {
	cc32_sysc_state *s = container_of(d, cc32_sysc_state, busdev.qdev);
        ...
}

This recovers larger scope for "inlined" C data structures,
i.e. find s such that &(s->busdev.qdev) == d

This avoids having to store back-pointers.

struct cc32_sysc_state {
        ...
        SysBusDevice busdev;
        ...
};
struct SysBusDevice {
        ...
        DeviceState  qdev;
        ...
};




[Reply][About]
[<<][arm][>>][..]