Skip to main content

The generator of a machine code decoder, transforming a user-defined machine code specification into decoder codes.

Project description

README: mcdecoder

The mcdecoder (Machine Code Decoder) is a set of tools to implement a machine code decoder. It includes tools to:

  • Generate a decoder for a user-defined machine code specification
  • Emulate a decoder for a binary data and show decoded result
  • Check the integrity of a machine code specification
  • etc.

Currently, the mcdecoder only generates decoders in C language.

Quickstart

  1. Define your machine code specification

    # arm.yaml
    machine:
      byteorder: little
    instructions:
      - name: add_immediate_a1
        format: xxxx:cond|00|1|0100|x:S|xxxx:Rn|xxxx:Rd|xxxx xxxx xxxx:imm12
    
  2. Generate a decoder

    mcdecoder generate arm.yaml
    
  3. Use the decoder from a C client

    const uint8_t kMachineCodes[] = { 0x04, 0xB0, 0x8D, 0xE2, };
    DecodeRequest request;
    DecodeResult result;
    bool succeeded;
    
    request.codes = &kMachineCodes[0];
    succeeded = DecodeInstruction(&request, &result);
    

For more details, follow Installation steps below and go on to Quickstart tutorial.

Who is mcdecoder for

  • Developers of a CPU emulator
    • To implement the decoder part of an emulator
  • Developers of a static analyzer for machine codes
    • To implement the decoder part of an analyzer
  • Learners of the basics about machine codes
    • Hands-on approach to learn: write and test actual machine codes

Implementing and maintaining a decoder are tough and cumbersome. The mcdecoder soothes these pains by generating a decoder. The mcdecoder was originally developed for athrill, a CPU emulator. It is now independent from athrill.

Requirements

  • Python 3.8 and above (with pip)

Installation

python3 -m pip install mcdecoder

License

The mcdecoder uses MIT License. See LICENSE for more details.

More details about usage

See documents for mcdecoder users.

For developers of mcdecoder

See documents for mcdecoder developers.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mcdecoder-0.1.1.tar.gz (29.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mcdecoder-0.1.1-py3-none-any.whl (34.2 kB view details)

Uploaded Python 3

File details

Details for the file mcdecoder-0.1.1.tar.gz.

File metadata

  • Download URL: mcdecoder-0.1.1.tar.gz
  • Upload date:
  • Size: 29.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for mcdecoder-0.1.1.tar.gz
Algorithm Hash digest
SHA256 646560f851df6030ae5b78e58e196dc789b75544543dff5a6d7a40da8028380b
MD5 21ff6e1e4441315dfdc86f20221110e2
BLAKE2b-256 b1a7d2c80b03905c0a09a67af60c1f7966fbd3dd235052ed108e06188fa881a1

See more details on using hashes here.

File details

Details for the file mcdecoder-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mcdecoder-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 34.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.18

File hashes

Hashes for mcdecoder-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 c3f8c72566a4d48eb598b1a72a096ac9b14ce2c591e988f9995e2ede0ab4d60e
MD5 e3267f46cac86c5dd4d01a345549de17
BLAKE2b-256 7762cf8a17d20156cee907fafa2c555ab172ac0ebae47277df8f5210d70d4633

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page