Ejemplo n.º 1
0
def collect_memobj_attrs(el, namespace, image, machine):
    """Collect the attributes of a memory section like element."""

    assert el is not None


    if el.tag == "stack" or el.tag == "heap":
        name = el.tag
    else:
        assert el.name is not None
        name = el.name

    values = image.new_attrs(namespace.add_namespace(name))

    values.file      = getattr(el, 'file', values.file)
    values.size      = getattr(el, 'size', values.size)
    values.virt_addr = getattr(el, 'virt_addr', values.virt_addr)
    values.phys_addr = getattr(el, 'phys_addr', values.phys_addr)
    values.direct    = getattr(el, 'direct', values.direct)
    values.virtpool  = getattr(el, 'virtpool', values.virtpool)
    values.physpool  = getattr(el, 'physpool', values.physpool)
    values.align     = getattr(el, 'align', values.align)
    values.scrub     = getattr(el, 'zero', values.scrub)
    values.user_map  = getattr(el, 'mem_type', values.user_map)

    if hasattr(el, 'mem_type'):
        values.mem_type  = translate_mem_types(el.mem_type)

    if hasattr(el, 'attach'):
        values.attach = attach_to_elf_flags(el.attach)

    if hasattr(el, 'pager'):
        values.pager = make_pager_attr(el.pager)

    if hasattr(el, 'cache_policy'):
        values.cache_policy = machine.get_cache_policy(el.cache_policy)

    return values
Ejemplo n.º 2
0
def collect_memobj_attrs(el, namespace, image, machine):
    """Collect the attributes of a memory section like element."""

    assert el is not None

    if el.tag == "stack" or el.tag == "heap":
        name = el.tag
    else:
        assert el.name is not None
        name = el.name

    values = image.new_attrs(namespace.add_namespace(name))

    values.file = getattr(el, 'file', values.file)
    values.size = getattr(el, 'size', values.size)
    values.virt_addr = getattr(el, 'virt_addr', values.virt_addr)
    values.phys_addr = getattr(el, 'phys_addr', values.phys_addr)
    values.direct = getattr(el, 'direct', values.direct)
    values.virtpool = getattr(el, 'virtpool', values.virtpool)
    values.physpool = getattr(el, 'physpool', values.physpool)
    values.align = getattr(el, 'align', values.align)
    values.scrub = getattr(el, 'zero', values.scrub)
    values.user_map = getattr(el, 'mem_type', values.user_map)

    if hasattr(el, 'mem_type'):
        values.mem_type = translate_mem_types(el.mem_type)

    if hasattr(el, 'attach'):
        values.attach = attach_to_elf_flags(el.attach)

    if hasattr(el, 'pager'):
        values.pager = make_pager_attr(el.pager)

    if hasattr(el, 'cache_policy'):
        values.cache_policy = machine.get_cache_policy(el.cache_policy)

    return values