MCPcopy Index your code
hub / github.com/qilingframework/qiling / select_arch

Function select_arch

qiling/utils.py:376–406  ·  view source on GitHub ↗
(archtype: QL_ARCH, cputype: Optional[QL_CPU], endian: QL_ENDIAN, thumb: bool)

Source from the content-addressed store, hash-verified

374
375
376def select_arch(archtype: QL_ARCH, cputype: Optional[QL_CPU], endian: QL_ENDIAN, thumb: bool) -> QlClassInit['QlArch']:
377 kwargs = {'cputype': cputype}
378
379 # set endianness and thumb mode for arm-based archs
380 if archtype is QL_ARCH.ARM:
381 kwargs['endian'] = endian
382 kwargs['thumb'] = thumb
383
384 # set endianness for mips arch
385 elif archtype is QL_ARCH.MIPS:
386 kwargs['endian'] = endian
387
388 module = {
389 QL_ARCH.A8086 : r'x86',
390 QL_ARCH.X86 : r'x86',
391 QL_ARCH.X8664 : r'x86',
392 QL_ARCH.ARM : r'arm',
393 QL_ARCH.ARM64 : r'arm64',
394 QL_ARCH.MIPS : r'mips',
395 QL_ARCH.CORTEX_M : r'cortex_m',
396 QL_ARCH.RISCV : r'riscv',
397 QL_ARCH.RISCV64 : r'riscv64',
398 QL_ARCH.PPC : r'ppc'
399 }[archtype]
400
401 qlarch_path = f'.arch.{module}'
402 qlarch_class = f'QlArch{archtype.name.upper()}'
403
404 obj = ql_get_module_function(qlarch_path, qlarch_class)
405
406 return partial(obj, **kwargs)
407
408
409def select_os(ostype: QL_OS) -> QlClassInit['QlOs']:

Callers 1

__init__Method · 0.85

Calls 1

ql_get_module_functionFunction · 0.85

Tested by

no test coverage detected