Code Monkey home page Code Monkey logo

hexagon's Introduction

hexagon

IDA processor module for the hexagon (QDSP6v55) processor

This is the processor found in recent qualcomm basebands ( MSM9xxx ) with LTE support, like the apple iPhone5 and Samsung Galaxy s3 ( GT-i9305 ) or Galaxy S5 ( SM-G900F )

Several versions of the programmers reference manual can be found online:

  • 80-NB419-1 Rev. A Hexagon V2 Programmer’s Reference Manual
  • 80-N2040-9 Rev. A Hexagon V4 Programmer’s Reference Manual
  • 80-N2040-8 Rev. H Hexagon V5/V55 Programmer’s Reference Manual
    • both the v4 and v5 refman can be found in this zip
  • 80-N2040-9 Rev. F Hexagon V5x Programmer’s Reference Manual
  • 80-N2040-33 Rev. D Hexagon V6x Programmer’s Reference Manual
    • both the v5.x and v6.x refman can be found in the Hexagon LLVM Tools 8.0 Document Bundle, which is installed as part of the Hexagon SDK
  • 80-N2040-30 Rev B Hexagon V60 HVX Programmer's Reference Manual
  • 80-N2040-37 Rev A Hexagon V62 HVX Programmer's Reference Manual
  • 80-N2040-36 Rev B Hexagon V62 Programmer's Reference Manual

check out https://developer.qualcomm.com/hexagon-processor for updates from qualcomm.

Available disassemblers:

Note: The Hexagon SDK uses LLVM, but with more hexagon instructions than the publicly available llvm code.

Processor Module

This processor module is a wrapper for the objdump code found on sourcery.mentor.com

Binary download

Binaries for OSX, Linux and Windows can be found under releases:

Installation

There are two variants of the hexagon module: one for ida and one for ida64. Copy the hexagon{64}.{dylib,dll,so} file to the procs subdirectory of your IDA installation. This module can probably also be used with the IDA Evaluation version. The IDA Free version can be used to view and change existing hexagon disassemblies, but it can not be used to start from scratch.

Usage

Start IDA, select 'Qualcomm Hexagon DSP v4:QDSP6' from the processor type.

When loading an ELF binary, IDA will tell you 'Undefined or unknown machine type 164.' you should answer 'Yes'. Then IDA well tell you about unknown flag bits, you can ignore that as well. IDA may also tell you the ELF has an illegal entry point.

Compiling

The build uses cmake to generate build files for your platform. The top level Makefile can call cmake in several ways.

  • On linux and MacOS build by typing make.
  • On Windows: either make vc, or make nmake.

You need the IDASDK ( Password protected ).

The gnutools are automatically downloaded.

You need a c++20 compiler, like visualstudio 2019, or any recent gcc or clang.

You can point cmake to the right SDK by setting the environment variable IDASDK to the basepath of the sdk.

On windows, first run the following command, to setup the right visualstudio environment.

vsdevcmd -arch=amd64

The sourcery gnutools

A stripped down version of the sourcery hexagon gnutools is downloaded from my xs4all page. This version does include some patches to silence some compiler warnings, and work around a problem in the original code where occasionally the disassembler would crash. The original archive is quite large ( 140M ) and can be found here. The GPL/LGPL license files are included in the tar file.

Preconfigured bfd.h and config.h files are included in this source archive.

Bugs

  • Stack variables not yet recognized
  • The first instruction of a segment is not always disassembled correctly, you can see it switch sometimes. ( this is because the objdump hexagon code keeps internal state in local static variables )
  • Switches are not yet recognized
  • Indirect jumps and calls are not yet marked as such
  • basic block ends are not correct in graph view
  • processor type is fixed to v5.5
  • module may crash when encountering some invalid instructions ( lumia 820 modem )
  • 'loop' instruction should have a code xref, instead of a data xref.

Building the gnutools

Note that this is NOT nescesary when using cmake.

  • create a build directory
  • Run ../pathtosource/configure with --target=hexagon and --disable-werror

Other Hexagon Processor modules

Author

Willem Hengeveld ([email protected])

History

2013-06-10 version 1.0

  • initial public release

2016-02-01 version 1.1

  • hexagon: now supporting v5 insn set. some improved insn matching code
  • updated to latest sourcery binutils release.

2017-12-05 version 1.2 - for idapro v7

  • completely reorganised plugin structure, support idav7 plugin structure.
  • hexagon: fixed addcref bug - now keeping stack of cmd vars.
  • fixed problem with code refs from memw[...] instructions.
  • fixed garbage label for invalid jump addresses
  • fixed incorrect code ref from memw()
  • corrected parsing of ##@ vs ##num

2022-02-12 version 1.3 - for IDA v7.7

  • updated to support ida v7.7
  • switch to cmake for build system.

2023-03-30 version 1.4

  • fixed 'interr 1112' in ida 8+
  • improved cmake wrapper for idasdk
  • automatic download of gnutools

2023-10-03 version 1.5

  • fixed windows build

License

Free

hexagon's People

Contributors

gsmk avatar nlitsme avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

hexagon's Issues

Unaligned OpOffset failure

Hey!
When trying the convert unaligned 4 bytes to offset, it fails with Command "OpOffset" failed.

OS: macOS Big Sur
IDA64: 8.0.220729 macOS x86_64

Thanks!

Incorrect IDA display of immediates

Seems like any use of the immediates will show up as "#name_of_function_in_that_address" instead of "#immediate_value", for example, the following instruction:
r0 = #0
is shown as:
r0 = #start (if start is in address 0).

Module looks for libida in hardcoded path

The linux module seems to be searching for libida in a hardcoded path:
20953 open("/home/itsme/idademo68/libida.so", O_RDONLY|O_CLOEXEC) = -1 ENOENT (No such file or directory)

Possible to add arg type conversion ?

Hello
Its nice to have ida module but its possible to improve this by add some arguments and type ref sync ?
i have log debug binary from OEM if any one want to check and improve module..

R0 i noticed most case use for result on return functions. also we have room to improve p0,new and cmp.eq stuff.. may be can make more user friendly for us ?

example.

{ call strlen
r0 = r18 }

Can be

r0 = strlen (r18)

"Chicken" Register

Disassembling the iPhone6,2_7.0.6_11B651_Restore.ipsw/Firmware/Mav7Mav8-1.03.02.Debug.bbfw/dsp1.mbn

LOAD:402000D0 03 C0 83 91                             r3 = memw (r3 + #0)
LOAD:402000D4 3F C0 03 67                             chicken = r3
LOAD:402000D8 40 C8 00 78                             r0 = #0x42

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.