sim: add validation to make sure there is memory where we're loading the kernel

This commit is contained in:
Krishnendra Nathella 2012-09-07 14:20:53 -05:00
parent 3742b19b36
commit 3f5ee1cf8c

View file

@ -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);