X86: Report an error if there's no kernel object, don't blindly use it.
authorGabe Black <gblack@eecs.umich.edu>
Sat, 21 Apr 2012 22:00:23 +0000 (15:00 -0700)
committerGabe Black <gblack@eecs.umich.edu>
Sat, 21 Apr 2012 22:00:23 +0000 (15:00 -0700)
This way the user gets a nice message instead of a less nice segfault.

src/arch/x86/system.cc

index effe1e99466f5a3ab3c9e2121fe9f28979fba9eb..87fb61edc1aa5f247ff7824c9896c5cd9a927a60 100644 (file)
@@ -114,6 +114,9 @@ X86System::initState()
 {
     System::initState();
 
+    if (!kernel)
+        fatal("No kernel to load.\n");
+
     if (kernel->getArch() == ObjectFile::I386)
         fatal("Loading a 32 bit x86 kernel is not supported.\n");