sim: remove kernel mapping check for baremetal workloads

Baremetal workloads are specified using the "kernel" parameter, but
don't always have the correct address mappings. This patch adds a
boolean flag to the system and bypasses the kernel addr mapping checks
when running in baremetal mode.
This commit is contained in:
Dam Sunwoo 2014-08-13 06:57:35 -04:00
parent 41d069ef6a
commit 74a4926fe0
2 changed files with 16 additions and 8 deletions

View file

@ -84,6 +84,8 @@ class System(MemObject):
init_param = Param.UInt64(0, "numerical value to pass into simulator") init_param = Param.UInt64(0, "numerical value to pass into simulator")
boot_osflags = Param.String("a", "boot flags to pass to the kernel") boot_osflags = Param.String("a", "boot flags to pass to the kernel")
kernel = Param.String("", "file that contains the kernel code") kernel = Param.String("", "file that contains the kernel code")
kernel_addr_check = Param.Bool(True,
"whether to address check on kernel (disable for baremetal)")
readfile = Param.String("", "file to read startup script from") readfile = Param.String("", "file to read startup script from")
symbolfile = Param.String("", "file to get the symbols from") symbolfile = Param.String("", "file to get the symbols from")
load_addr_mask = Param.UInt64(0xffffffffff, load_addr_mask = Param.UInt64(0xffffffffff,

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2011-2013 ARM Limited * Copyright (c) 2011-2014 ARM Limited
* All rights reserved * All rights reserved
* *
* The license below extends only to copyright in the software and shall * The license below extends only to copyright in the software and shall
@ -274,13 +274,19 @@ System::initState()
* Load the kernel code into memory * Load the kernel code into memory
*/ */
if (params()->kernel != "") { if (params()->kernel != "") {
// Validate kernel mapping before loading binary if (params()->kernel_addr_check) {
if (!(isMemAddr((kernelStart & loadAddrMask) + loadAddrOffset) && // Validate kernel mapping before loading binary
isMemAddr((kernelEnd & loadAddrMask) + loadAddrOffset))) { if (!(isMemAddr((kernelStart & loadAddrMask) +
fatal("Kernel is mapped to invalid location (not memory). " loadAddrOffset) &&
"kernelStart 0x(%x) - kernelEnd 0x(%x) %#x:%#x\n", kernelStart, isMemAddr((kernelEnd & loadAddrMask) +
kernelEnd, (kernelStart & loadAddrMask) + loadAddrOffset, loadAddrOffset))) {
(kernelEnd & loadAddrMask) + loadAddrOffset); fatal("Kernel is mapped to invalid location (not memory). "
"kernelStart 0x(%x) - kernelEnd 0x(%x) %#x:%#x\n",
kernelStart,
kernelEnd, (kernelStart & loadAddrMask) +
loadAddrOffset,
(kernelEnd & loadAddrMask) + loadAddrOffset);
}
} }
// Load program sections into memory // Load program sections into memory
kernel->loadSections(physProxy, loadAddrMask, loadAddrOffset); kernel->loadSections(physProxy, loadAddrMask, loadAddrOffset);