1 This is how devices are hooked into the system:
2 This is very similar to Linux Modules and device drivers.
5 Devices are kept in their own directory structure:
7 HEADERS => include/devices
10 Each device implements the following:
11 * a create_[device] function that returns a (struct vm_device *).
12 * a set of operations found in (struct vm_device_ops).
13 (currently only init and deinit are called, the rest are not fully thought out...)
15 The control flow goes like this:
17 1. The VMM calls create_[device]() which returns a (struct vm_device *).
19 2. This function calls create_device(char *name, struct vm_device_ops * ops, void * private_data);
20 * The arguments are device specific, and the pointer is returned to the VMM. No instance
21 specific initialization should be done here
23 3. The VMM then calls attach_device(struct guest_info * vm, struct vm_device * dev) to associate the
24 device with a virtual machine
26 4. attach_device then calls the ops->init() function found in the (struct vm_device *)
27 * This init function is where all the instance specific initialization is done. A pointer to the virtual machine
28 the device is associated with is stored in vm_device->vm.
29 * Any event hooks should be done here.
33 Disconnection goes like this:
35 1. The VMM calls unattach_device(struct vm_device * dev)
37 2. unattach_device calls the ops->deinit() function found in the (struct vm_device *)
38 * All the instance specific deinitialization should be done here
39 * Any event hooks that were taken should be released
41 3. The VMM then calls free_device(struct vm_device * dev);