Пример #1
0
def getArchModules(default=ARCH_DEFAULT):
    '''
    Retrieve a default array of arch modules ( where index 0 is
    also the "named" or "default" arch module.
    '''
    import envi.archs.h8 as e_h8
    import envi.archs.arm as e_arm
    import envi.archs.i386 as e_i386
    import envi.archs.amd64 as e_amd64
    import envi.archs.thumb16 as e_thumb16
    import envi.archs.msp430 as e_msp430

    archs = [None]

    # These must be in ARCH_FOO order
    archs.append(e_i386.i386Module())
    archs.append(e_amd64.Amd64Module())
    archs.append(e_arm.ArmModule())
    archs.append(e_thumb16.Thumb16Module())
    archs.append(e_thumb16.ThumbModule())
    archs.append(e_msp430.Msp430Module())
    archs.append(e_h8.H8Module())

    # Set the default module ( or None )
    archs[ARCH_DEFAULT] = archs[default >> 16]

    return archs
Пример #2
0
def getArchModule(name=None):
    """
    return an Envi architecture module instance for the following
    architecture name.
    
    Current architectures include:

    i386 - Intel i386
    amd64 - The new 64bit AMD spec.
    """
    if name == None:
        name = getCurrentArch()

    # Some builds have x86 (py2.6) and some have other stuff...
    if name in ["i386","i486","i586","i686","x86"]:
        import envi.archs.i386 as e_i386
        return e_i386.i386Module()

    elif name == "amd64":
        import envi.archs.amd64 as e_amd64
        return e_amd64.Amd64Module()

    elif name == 'arm':
        import envi.archs.arm as e_arm
        return e_arm.ArmModule()

    else:
        raise ArchNotImplemented(name)
Пример #3
0
def generateTestInfo(ophexbytez='6e'):
    a64 = e_amd64.Amd64Module()
    opbytez = ophexbytez
    op = a64.archParseOpcode(opbytez.decode('hex'), 0, 0x4000)
    print "opbytez = '%s'\noprepr = '%s'"%(opbytez,repr(op))
    opvars=vars(op)
    opers = opvars.pop('opers')
    print "opcheck = ",repr(opvars)

    opersvars = []
    for x in range(len(opers)):
        opervars = vars(opers[x])
        opervars.pop('_dis_regctx')
        opersvars.append(opervars)

    print "opercheck = %s" % (repr(opersvars))
Пример #4
0
def getArchModule(name=None):
    """
    return an Envi architecture module instance for the following
    architecture name.

    Current architectures include:

    i386 - Intel i386
    amd64 - The new 64bit AMD spec.
    """
    if name is None:
        name = getCurrentArch()

    # Some builds have x86 (py2.6) and some have other stuff...
    if name in ['i386', 'i486', 'i586', 'i686', 'x86']:
        import envi.archs.i386 as e_i386
        return e_i386.i386Module()

    elif name in ('amd64', 'x86_64'):
        import envi.archs.amd64 as e_amd64
        return e_amd64.Amd64Module()

    elif name in ('arm', 'armv6l', 'armv7l'):
        import envi.archs.arm as e_arm
        return e_arm.ArmModule()

    elif name in ('thumb', 'thumb16', 'thumb2'):
        import envi.archs.thumb16 as e_thumb
        return e_thumb.Thumb16Module()

    elif name in ('msp430', ):
        import envi.archs.msp430 as e_msp430
        return e_msp430.Msp430Module()

    elif name in ('h8', ):
        import envi.archs.h8 as e_h8
        return e_h8.H8Module()

    else:
        raise ArchNotImplemented(name)