From: Krishnendra Nathella Date: Fri, 7 Sep 2012 19:20:53 +0000 (-0500) Subject: sim: add validation to make sure there is memory where we're loading the kernel X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=3f5ee1cf8c9e840426e3110644180fed5a1dbcb0;p=gem5.git sim: add validation to make sure there is memory where we're loading the kernel --- diff --git a/src/sim/system.cc b/src/sim/system.cc index 2dd4d41bd..4871ac824 100644 --- a/src/sim/system.cc +++ b/src/sim/system.cc @@ -266,6 +266,13 @@ System::initState() * Load the kernel code into memory */ if (params()->kernel != "") { + // Validate kernel mapping before loading binary + if (!(isMemAddr(kernelStart & loadAddrMask) && + isMemAddr(kernelEnd & loadAddrMask))) { + fatal("Kernel is mapped to invalid location (not memory). " + "kernelStart 0x(%x) - kernelEnd 0x(%x)\n", kernelStart, + kernelEnd); + } // Load program sections into memory kernel->loadSections(physProxy, loadAddrMask);