面向对象的设备模型
qemu中的函数重载
k->realize = pci_qdev_realize;面向对象的设备模型
+--------------------------+ +----------------------+
| | | |
| ObjectClass | <-------------------------| Object |
| class_init | | instance_init |
| | |(object_instance_init)|
+--------------------------+ +----------------------+
| |
| |
| |
v v
+--------------------------+ +----------------------+
| | | |
| DeviceClass | <--------------------- | DeviceState |
| class_init | | instance_init |
| (device_class_init) | | (device_initfn) |
| | | |
| realize | overwrite by child class | |
| unrealize | | |
+--------------------------+ +----------------------+
| |
| |
| |
v v
+--------------------------+ +----------------------+
| | | |
| PCIDeviceClass | <--------------------- | PCIDevice |
| class_init | | instance_init |
| (pci_device_class_init)| | (NULL) |
| realize | | |
| (pci_qdev_realize) | call PCIDevice->realize | |
| unrealize | | |
| (pci_qdev_unrealize) | | |
+--------------------------+ +----------------------+
| |
| |
| |
v v
+--------------------------+ +----------------------+
| | | |
| E1000BaseClass | <-------------------- | E1000State |
| class_init | | instance_init |
| (e1000_class_init) | | (e1000_instance_init)|
| realize | | |
| (pci_e1000_realize) | | |
| unrealize | | |
| | | |
+--------------------------+ +----------------------+Last updated