From 3f5ee1cf8c9e840426e3110644180fed5a1dbcb0 Mon Sep 17 00:00:00 2001 From: Krishnendra Nathella Date: Fri, 7 Sep 2012 14:20:53 -0500 Subject: [PATCH] sim: add validation to make sure there is memory where we're loading the kernel --- src/sim/system.cc | 7 +++++++ 1 file changed, 7 insertions(+) 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); -- 2.30.2