mirror of
https://github.com/xen-project/xen.git
synced 2026-10-28 02:01:24 +01:00
libxc: reorganize domain builder guest memory allocator
Guest memory allocation in the domain builder of libxc is done via virtual addresses only. In order to be able to support preallocated areas not virtually mapped reorganize the memory allocator to keep track of allocated pages globally and in allocated segments. This requires an interface change of the allocate callback of the domain builder which currently is using the last mapped virtual address as a parameter. This is no problem as the only user of this callback is stubdom/grub/kexec.c using this virtual address to calculate the last used pfn. Signed-off-by: Juergen Gross <jgross@suse.com> Acked-by: Wei Liu <wei.liu2@citrix.com>
This commit is contained in:
1 parent
6853c9bf9f
commit
ea7c8a3d0e
3 files changed
+85
-53
No files matched your search
@@ -100,9 +100,9 @@ static void do_exchange(struct xc_dom_image *dom, xen_pfn_t target_pfn, xen_pfn_
|
||||
dom->p2m_host[target_pfn] = source_mfn;
|
||||
}
|
||||
|
||||
int kexec_allocate(struct xc_dom_image *dom, xen_vaddr_t up_to)
|
||||
int kexec_allocate(struct xc_dom_image *dom)
|
||||
{
|
||||
unsigned long new_allocated = (up_to - dom->parms.virt_base) / PAGE_SIZE;
|
||||
unsigned long new_allocated = dom->pfn_alloc_end - dom->rambase_pfn;
|
||||
unsigned long i;
|
||||
|
||||
pages = realloc(pages, new_allocated * sizeof(*pages));
|
||||
@@ -319,8 +319,6 @@ void kexec(void *kernel, long kernel_size, void *module, long module_size, char
|
||||
|
||||
/* Make sure the bootstrap page table does not RW-map any of our current
|
||||
* page table frames */
|
||||
kexec_allocate(dom, dom->virt_pgtab_end);
|
||||
|
||||
if ( (rc = xc_dom_update_guest_p2m(dom))) {
|
||||
grub_printf("xc_dom_update_guest_p2m returned %d\n", rc);
|
||||
errnum = ERR_BOOT_FAILURE;
|
||||
|
||||