From 95b782f60005b58275889e3c5ab2a62ccc7d59c5 Mon Sep 17 00:00:00 2001 From: Nilay Vaish Date: Mon, 27 Jan 2014 18:50:51 -0600 Subject: config: allow more than 3GB of memory for x86 simulations This patch edits the configuration files so that x86 simulations can have more than 3GB of memory. It also corrects a bug in the MemConfig.py script. --- configs/common/FSConfig.py | 28 ++++++++++++++++++++++++---- 1 file changed, 24 insertions(+), 4 deletions(-) (limited to 'configs/common/FSConfig.py') diff --git a/configs/common/FSConfig.py b/configs/common/FSConfig.py index 58ad1a7c9..84dbb9b3a 100644 --- a/configs/common/FSConfig.py +++ b/configs/common/FSConfig.py @@ -407,7 +407,16 @@ def makeX86System(mem_mode, numCPUs = 1, mdesc = None, self = None, self.mem_mode = mem_mode # Physical memory - self.mem_ranges = [AddrRange(mdesc.mem())] + # On the PC platform, the memory region 0xC0000000-0xFFFFFFFF is reserved + # for various devices. Hence, if the physical memory size is greater than + # 3GB, we need to split it into two parts. + excess_mem_size = \ + convert.toMemorySize(mdesc.mem()) - convert.toMemorySize('3GB') + if excess_mem_size <= 0: + self.mem_ranges = [AddrRange(mdesc.mem())] + else: + self.mem_ranges = [AddrRange('3GB'), + AddrRange(Addr('4GB'), size = excess_mem_size)] # Platform self.pc = Pc() @@ -501,21 +510,32 @@ def makeLinuxX86System(mem_mode, numCPUs = 1, mdesc = None, # just to avoid corner cases. phys_mem_size = sum(map(lambda r: r.size(), self.mem_ranges)) assert(phys_mem_size >= 0x200000) + assert(len(self.mem_ranges) <= 2) - self.e820_table.entries = \ + entries = \ [ # Mark the first megabyte of memory as reserved X86E820Entry(addr = 0, size = '639kB', range_type = 1), X86E820Entry(addr = 0x9fc00, size = '385kB', range_type = 2), - # Mark the rest as available + # Mark the rest of physical memory as available X86E820Entry(addr = 0x100000, - size = '%dB' % (phys_mem_size - 0x100000), + size = '%dB' % (self.mem_ranges[0].size() - 0x100000), range_type = 1), # Reserve the last 16kB of the 32-bit address space for the # m5op interface X86E820Entry(addr=0xFFFF0000, size='64kB', range_type=2), ] + # In case the physical memory is greater than 3GB, we split it into two + # parts and add a separate e820 entry for the second part. This entry + # starts at 0x100000000, which is the first address after the space + # reserved for devices. + if len(self.mem_ranges) == 2: + entries.append(X86E820Entry(addr = 0x100000000, + size = '%dB' % (self.mem_ranges[1].size()), range_type = 1)) + + self.e820_table.entries = entries + # Command line self.boot_osflags = 'earlyprintk=ttyS0 console=ttyS0 lpj=7999923 ' + \ 'root=/dev/hda1' -- cgit v1.2.3