bdpayne/libvmi — pull request #82 by awsaba (2013-06-24 16:06:34+00:00)
Title: Abstracting OS specific functions into an interface

The purpose of this patch is to
1. Call out functionality that must or should be implemented on a per-OS basis
2. Make it easier to add new guest OS support by limiting the number `if (vmi->os_type)` statements in the core.

This follows the general pattern of the VM drivers: a struct with generic function pointers and a struct for OS specific data. They only make sense to create during a `vmi_init(..., VMI_INIT_COMPLETE)`, so I don't think the `driver_get_instance()` abstraction is necessary.

I've tested with a 64-bit Linux guest and and 32-bit Windows XP guest.

Possible breaking change: removed `page_offset` from `vmi_instance`. It doesn't appear to be used within libvmi anywhere. If it needs to be added back because something I didn't see depends on it, I think it should be worked in to the OS interfaces.

It should also be noted that `vmi_get_offset()` returns `unsigned long` but is processed and stored internally as `int`. I can include a fix for that in this PR or submit another one later to fix that.