* Return the end of the non-module region starting at s. In other
* words return s the start of the next modules after s.
*
- * Also returns the end of that module in *n.
+ * On input *end is the end of the region which should be considered
+ * and it is updated to reflect the end of the module, clipped to the
+ * end of the region if it would run over.
*/
-static paddr_t __init next_module(paddr_t s, paddr_t *n)
+static paddr_t __init next_module(paddr_t s, paddr_t *end)
{
struct dt_module_info *mi = &early_info.modules;
paddr_t lowest = ~(paddr_t)0;
continue;
if ( mod_s > lowest )
continue;
+ if ( mod_s > *end )
+ continue;
lowest = mod_s;
- *n = mod_e;
+ *end = min(*end, mod_e);
}
return lowest;
}
e = n = bank_end;
}
+ if ( e > bank_end )
+ e = bank_end;
+
setup_xenheap_mappings(s>>PAGE_SHIFT, (e-s)>>PAGE_SHIFT);
xenheap_mfn_end = e;