X-Git-Url: http://v3vee.org/palacios/gitweb/gitweb.cgi?p=palacios.git;a=blobdiff_plain;f=palacios%2Fsrc%2Fdevices%2FREADME;fp=palacios%2Fsrc%2Fdevices%2FREADME;h=087a0e136e45bc57cb6fa8acf46fd53b75f6e441;hp=0000000000000000000000000000000000000000;hb=ddc16b0737cf58f7aa90a69c6652cdf4090aec51;hpb=626595465a2c6987606a6bc697df65130ad8c2d3 diff --git a/palacios/src/devices/README b/palacios/src/devices/README new file mode 100644 index 0000000..087a0e1 --- /dev/null +++ b/palacios/src/devices/README @@ -0,0 +1,41 @@ +This is how devices are hooked into the system: +This is very similar to Linux Modules and device drivers. + + +Devices are kept in their own directory structure: +SOURCE => src/devices +HEADERS => include/devices + + +Each device implements the following: + * a create_[device] function that returns a (struct vm_device *). + * a set of operations found in (struct vm_device_ops). + (currently only init and deinit are called, the rest are not fully thought out...) + +The control flow goes like this: + +1. The VMM calls create_[device]() which returns a (struct vm_device *). + +2. This function calls create_device(char *name, struct vm_device_ops * ops, void * private_data); + * The arguments are device specific, and the pointer is returned to the VMM. No instance + specific initialization should be done here + +3. The VMM then calls attach_device(struct guest_info * vm, struct vm_device * dev) to associate the + device with a virtual machine + +4. attach_device then calls the ops->init() function found in the (struct vm_device *) + * This init function is where all the instance specific initialization is done. A pointer to the virtual machine + the device is associated with is stored in vm_device->vm. + * Any event hooks should be done here. + + + +Disconnection goes like this: + +1. The VMM calls unattach_device(struct vm_device * dev) + +2. unattach_device calls the ops->deinit() function found in the (struct vm_device *) + * All the instance specific deinitialization should be done here + * Any event hooks that were taken should be released + +3. The VMM then calls free_device(struct vm_device * dev);