This includes quite a few cleanups / refactoring of the old code, some of which is intended to prepare for 64-bit save/restore. Signed-off-by: Steven Hand <steven@xensource.com>