aboutsummaryrefslogtreecommitdiffstats
path: root/xen/arch/x86/x86_64/mm.c
diff options
context:
space:
mode:
authorJan Beulich <jbeulich@novell.com>2011-03-09 16:14:59 +0000
committerJan Beulich <jbeulich@novell.com>2011-03-09 16:14:59 +0000
commitbe68c24351805ab7840ba13c6ac89dc1fc3e58f5 (patch)
tree5273c1ac42367253e8acbad37f7985398961d477 /xen/arch/x86/x86_64/mm.c
parent28d6207bfcb0f703cad8d323ab0f92e5fa8bbc2e (diff)
downloadxen-be68c24351805ab7840ba13c6ac89dc1fc3e58f5.tar.gz
xen-be68c24351805ab7840ba13c6ac89dc1fc3e58f5.tar.bz2
xen-be68c24351805ab7840ba13c6ac89dc1fc3e58f5.zip
x86: don't BUG() post-boot in alloc_xen_pagetable()
Instead, propagate the condition to the caller, all of which also get adjusted to check for that situation. Signed-off-by: Jan Beulich <jbeulich@novell.com>
Diffstat (limited to 'xen/arch/x86/x86_64/mm.c')
-rw-r--r--xen/arch/x86/x86_64/mm.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/xen/arch/x86/x86_64/mm.c b/xen/arch/x86/x86_64/mm.c
index e973c0edcb..e8041a3de1 100644
--- a/xen/arch/x86/x86_64/mm.c
+++ b/xen/arch/x86/x86_64/mm.c
@@ -84,8 +84,9 @@ void *alloc_xen_pagetable(void)
if ( !early_boot )
{
struct page_info *pg = alloc_domheap_page(NULL, 0);
- BUG_ON(pg == NULL);
- return page_to_virt(pg);
+
+ BUG_ON(!dom0 && !pg);
+ return pg ? page_to_virt(pg) : NULL;
}
mfn = alloc_boot_pages(1, 1);
@@ -100,6 +101,9 @@ l3_pgentry_t *virt_to_xen_l3e(unsigned long v)
if ( !(l4e_get_flags(*pl4e) & _PAGE_PRESENT) )
{
l3_pgentry_t *pl3e = alloc_xen_pagetable();
+
+ if ( !pl3e )
+ return NULL;
clear_page(pl3e);
l4e_write(pl4e, l4e_from_paddr(__pa(pl3e), __PAGE_HYPERVISOR));
}
@@ -112,9 +116,15 @@ l2_pgentry_t *virt_to_xen_l2e(unsigned long v)
l3_pgentry_t *pl3e;
pl3e = virt_to_xen_l3e(v);
+ if ( !pl3e )
+ return NULL;
+
if ( !(l3e_get_flags(*pl3e) & _PAGE_PRESENT) )
{
l2_pgentry_t *pl2e = alloc_xen_pagetable();
+
+ if ( !pl2e )
+ return NULL;
clear_page(pl2e);
l3e_write(pl3e, l3e_from_paddr(__pa(pl2e), __PAGE_HYPERVISOR));
}