Take care, this code is used by both xen and tools ...