Пример #1
0
def get_info_storage(ptrn_list, priority, is_3dnow):
    """convert list of pattern_t objects to ild_storage_t object"""

    storage = ild_storage.ild_storage_t(is_amd=is_3dnow)

    for p in ptrn_list:
        info = ild_info.ptrn_to_info(p, priority)
        if info not in storage.get_info_list(p.insn_map, p.opcode):
            storage.append_info(p.insn_map, p.opcode, info)
    return storage
Пример #2
0
def _get_info_storage(agi, ptrn_list, priority):
    """convert list of pattern_t objects to ild_storage_t object, store by
       map/opcode"""

    lookup = ild_storage.get_lookup(agi)
    storage = ild_storage.ild_storage_t(lookup)

    for p in ptrn_list:
        info = ild_info.ptrn_to_info(p, priority) # convert to ild_info_t
        if info not in storage.get_info_list(p.insn_map,p.opcode):
            storage.append_info(p.insn_map, p.opcode, info)
    return storage
Пример #3
0
def _get_united_lookup(ptrn_list, is_3dnow):
    """
    Combine storage obtained from grammar and from ILD storage
    @return: ild_info.storage_t object
    """
    #build an ild_info_storage_t object from grammar
    from_grammar = get_info_storage(ptrn_list, 0, is_3dnow)

    #get an ild_info_storage_t object from ild python-based storage
    from_storage = ild_storage_data.gen_ild_info()

    #FIXME: should we make is_amd=(is_3dnow or from_storage.is_3dnow)?
    united_lookup = ild_storage.ild_storage_t(is_amd=is_3dnow)

    #unite the lookups, conflicts will be resolved by priority
    for insn_map in ild_info.get_maps(is_3dnow):
        for op in range(0, 256):
            ulist = (from_grammar.get_info_list(insn_map, hex(op)) +
                     from_storage.get_info_list(insn_map, hex(op)))
            united_lookup.set_info_list(insn_map, hex(op), ulist)
    return united_lookup
Пример #4
0
def gen_ild_info():
    # FIXME: can use this to define length properties for illegal opcodes
    storage = ild_storage.ild_storage_t(is_amd=True)
    return storage