Rework config system yet again, and start filling in some of the requirements.

This commit is contained in:
Mike Auty
2015-04-09 15:56:57 -05:00
parent 3d00956951
commit a85bcb9e58
8 changed files with 123 additions and 59 deletions
+24 -6
View File
@@ -4,19 +4,37 @@ __author__ = 'mike'
class IntelContextModifier(interfaces.context.ContextModifierInterface):
def __init__(self, config):
pass
@classmethod
def requirements(cls):
return [config.ChoiceRequirement(name = "architecture",
choices = ["auto", "pae", "32", "64"],
description = "Determines the memory image",
default = "auto"),
config.IntRequirement(name = "pagemapoffset",
description = "Offset to the directory table base")]
config.IntRequirement(name = "page_map_offset",
description = "Offset to the directory table base"),
config.StringRequirement(name = 'layer_name',
description = 'Name of the layer to be added to the memory space',
default = 'intel'),
config.StringRequirement(name = 'physical_layer',
description = "Layer name for the physical layer"),
config.StringRequirement(name = 'swap_layer',
description = "Layer name for the swap layer",
optional = True)]
def __call__(self, context):
# TODO: Attempt to determine whether the image is 32, PAE or x64 (although the context must already know whether it is x64)
intel = layers.intel.IntelPAE(context, 'kernel', 'physical', page_map_offset = 0x319000)
config = self.config_get(context)
layer = None
if config.get('architecture') == 'pae':
layer = layers.intel.IntelPAE
elif config.get('architecture') == '32':
layer = layers.intel.Intel
elif config.get('architecture') == '64':
layer = layers.intel.Intel32e
else:
#TODO: Add automagic here
layer = layers.intel.IntelPAE
intel = layer(context, config.get('layer_name'), config.get('physical_layer'), page_map_offset = config.get('pagemapoffset'))
context.add_layer(intel)