Giter Club home page Giter Club logo

binaryninja_avr's Introduction

Binary Ninja AVR plugin

This plugin adds support for the AVR architecture to binaryninja. Most of the instructions can be lifted (mostly) correctly.

Disassembly Lifted

Installation

Run this command in your BN plugins folder: git clone https://github.com/fluxchief/binaryninja_avr.git

Another option is to download this repository as a ZIP file and extract it in your BN plugins folder.

How is it different than binja_avr?

  1. This project aims for a better support of different chips. It currently has
  • ATMega16
  • ATMega168
  • ATTiny48
  • ATTiny88
  • ATXMega128A4u

support and can be easily extended.

  1. This plugin also lifts the AVR instructions. While I at first intended to add lifting to binja-avr, the changes would have been to large so that I decided to write this plugin from scratch instead.

  2. Interrupt vectors are defined automatically.

  3. Xrefs on memory.

I found a bug!

"Awesome"! Please create a ticket upload your sample there as well (if possible).

Known issues/limitations

  • Memory accesses are weird. I had to place the data segment to an offset (currently 0x10 0000) because BN does not know about harvard architectures. This means if you have some offset in memory and want to look at this address, add 0x10 0000). This also causes memory access in medium IL view where BN could not resolve the address to look like this: [GPIO0 + (123 | ((zx.w(r31) << 8) | (zx.w(r30))))].b. GPIO0 is the first io register stored at RAM:0 (or 0x10 0000) - so you see where this is going.
  • Subregisters are not shown as such. This is relevant for X/Y/Z registers (r27:r26, r29:r28, r31:r30). The reason for this is a bug in BN that degrades the result of lifting (See issue #4). Tl;dr: It looks better but xrefs break.
  • Memory is treated as volatile. This makes sense for memory mapped (e)IO registers but we don't really want to have it for the other memory area. However there is nothing we can do about it, so lifting is not as good as it could be.
  • RAMPX/RAMPY/RAMPZ not used - This isn't lifted as much as it could be and decreases the readability of the code, so I disabled the use of these registers.
  • Skip instruction followed by a 4 bytes instruction breaks stuff. This is also because of a limitation of BN. BN only sends the raw bytes until the end of the basic block to the plugin, so there is no way we can figure out whether the length of the next instruction is 2 or 4 bytes. It seems to be 2 bytes most of the cases, so I hardcoded it to 2.
  • Flags aren't used (in lifting).

License

MIT

binaryninja_avr's People

Contributors

fluxchief avatar karlvogel avatar

Watchers

James Cloos avatar  avatar

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.