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()
# 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'