X86, Config: Move the setting of work count options to a separate function.

This way things that don't care about work count options and/or aren't called
by something that has those command line options set up doesn't have to build
a fake object to carry in inert values.
This commit is contained in:
Gabe Black 2011-02-07 01:22:15 -08:00
parent 0c4b816d84
commit f8fc0419c5
3 changed files with 22 additions and 20 deletions

View file

@ -405,8 +405,24 @@ def makeX86System(mem_mode, numCPUs = 1, mdesc = None, self = None, Ruby = False
for i in range(3, 15): for i in range(3, 15):
assignISAInt(i, i) assignISAInt(i, i)
def makeLinuxX86System(mem_mode, options, mdesc = None, Ruby = False): def setWorkCountOptions(system, options):
numCPUs = options.num_cpus if options.work_item_id != None:
system.work_item_id = options.work_item_id
if options.work_begin_cpu_id_exit != None:
system.work_begin_cpu_id_exit = options.work_begin_cpu_id_exit
if options.work_end_exit_count != None:
system.work_end_exit_count = options.work_end_exit_count
if options.work_end_checkpoint_count != None:
system.work_end_ckpt_count = options.work_end_checkpoint_count
if options.work_begin_exit_count != None:
system.work_begin_exit_count = options.work_begin_exit_count
if options.work_begin_checkpoint_count != None:
system.work_begin_ckpt_count = options.work_begin_checkpoint_count
if options.work_cpus_checkpoint_count != None:
system.work_cpus_ckpt_count = options.work_cpus_checkpoint_count
def makeLinuxX86System(mem_mode, numCPUs = 1, mdesc = None, Ruby = False):
self = LinuxX86System() self = LinuxX86System()
# Build up the x86 system and then specialize it for Linux # Build up the x86 system and then specialize it for Linux
@ -416,22 +432,6 @@ def makeLinuxX86System(mem_mode, options, mdesc = None, Ruby = False):
# just to avoid corner cases. # just to avoid corner cases.
assert(self.physmem.range.second.getValue() >= 0x200000) assert(self.physmem.range.second.getValue() >= 0x200000)
# set work count options
if options.work_item_id != None:
self.work_item_id = options.work_item_id
if options.work_begin_cpu_id_exit != None:
self.work_begin_cpu_id_exit = options.work_begin_cpu_id_exit
if options.work_end_exit_count != None:
self.work_end_exit_count = options.work_end_exit_count
if options.work_end_checkpoint_count != None:
self.work_end_ckpt_count = options.work_end_checkpoint_count
if options.work_begin_exit_count != None:
self.work_begin_exit_count = options.work_begin_exit_count
if options.work_begin_checkpoint_count != None:
self.work_begin_ckpt_count = options.work_begin_checkpoint_count
if options.work_cpus_checkpoint_count != None:
self.work_cpus_ckpt_count = options.work_cpus_checkpoint_count
# Mark the first megabyte of memory as reserved # Mark the first megabyte of memory as reserved
self.e820_table.entries.append(X86E820Entry( self.e820_table.entries.append(X86E820Entry(
addr = 0, addr = 0,

View file

@ -131,7 +131,8 @@ elif buildEnv['TARGET_ISA'] == "mips":
elif buildEnv['TARGET_ISA'] == "sparc": elif buildEnv['TARGET_ISA'] == "sparc":
test_sys = makeSparcSystem(test_mem_mode, bm[0]) test_sys = makeSparcSystem(test_mem_mode, bm[0])
elif buildEnv['TARGET_ISA'] == "x86": elif buildEnv['TARGET_ISA'] == "x86":
test_sys = makeLinuxX86System(test_mem_mode, options, bm[0]) test_sys = makeLinuxX86System(test_mem_mode, options.num_cpus, bm[0])
setWorkCountOptions(test_sys, options)
elif buildEnv['TARGET_ISA'] == "arm": elif buildEnv['TARGET_ISA'] == "arm":
test_sys = makeLinuxArmSystem(test_mem_mode, bm[0], test_sys = makeLinuxArmSystem(test_mem_mode, bm[0],
bare_metal=options.bare_metal, machine_type=options.machine_type) bare_metal=options.bare_metal, machine_type=options.machine_type)

View file

@ -116,7 +116,8 @@ if buildEnv['TARGET_ISA'] == "alpha":
system.piobus, system.piobus,
system.dma_devices) system.dma_devices)
elif buildEnv['TARGET_ISA'] == "x86": elif buildEnv['TARGET_ISA'] == "x86":
system = makeLinuxX86System(test_mem_mode, options, bm[0], True) system = makeLinuxX86System(test_mem_mode, options.num_cpus, bm[0], True)
setWorkCountOptions(system, options)
system.ruby = Ruby.create_system(options, system.ruby = Ruby.create_system(options,
system, system,
system.piobus) system.piobus)