diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-04-06 02:04:22 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-04-06 02:04:22 +0200 |
commit | 506e5a3b1f2bbd87dad745d3288497b369b77a62 (patch) | |
tree | 5da1f34bf50c201db5d6210c2dfca2983a7170aa /kern | |
parent | d46142c38c92297c6db2ef6a89b1ea01fad7c150 (diff) |
Fix crash on Xen when no module is provided
* kern/bootstrap.c (bootstrap_create): Iterate over bmods only
if is not NULL.
Diffstat (limited to 'kern')
-rw-r--r-- | kern/bootstrap.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/kern/bootstrap.c b/kern/bootstrap.c index cf10d67..c07b032 100644 --- a/kern/bootstrap.c +++ b/kern/bootstrap.c @@ -110,12 +110,13 @@ void bootstrap_create() #ifdef MACH_XEN struct multiboot_module *bmods = ((struct multiboot_module *) boot_info.mod_start); - int n; - for (n = 0; bmods[n].mod_start; n++) { - bmods[n].mod_start = kvtophys(bmods[n].mod_start + (vm_offset_t) bmods); - bmods[n].mod_end = kvtophys(bmods[n].mod_end + (vm_offset_t) bmods); - bmods[n].string = kvtophys(bmods[n].string + (vm_offset_t) bmods); - } + int n = 0; + if (bmods) + for (n = 0; bmods[n].mod_start; n++) { + bmods[n].mod_start = kvtophys(bmods[n].mod_start + (vm_offset_t) bmods); + bmods[n].mod_end = kvtophys(bmods[n].mod_end + (vm_offset_t) bmods); + bmods[n].string = kvtophys(bmods[n].string + (vm_offset_t) bmods); + } boot_info.mods_count = n; boot_info.flags |= MULTIBOOT_MODS; #else /* MACH_XEN */ |