Skip to main content

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.

Release files for mcdecoder 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mcdecoder 0.1.1
File Size Uploaded
mcdecoder-0.1.1.tar.gz 29.4 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mcdecoder 0.1.1
File Interpreter ABI Platform
mcdecoder-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 63.5 kB

Release files / mcdecoder-0.1.1.tar.gz

Download URL mcdecoder-0.1.1.tar.gz
Size 29.4 kB
Tags Source
SHA-256 checksum
How to use checksums
646560f851df6030ae5b78e58e196dc789b75544543dff5a6d7a40da8028380b
BLAKE2b-256 checksum
How to use checksums
b1a7d2c80b03905c0a09a67af60c1f7966fbd3dd235052ed108e06188fa881a1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release files / mcdecoder-0.1.1-py3-none-any.whl

Download URL mcdecoder-0.1.1-py3-none-any.whl
Size 34.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
c3f8c72566a4d48eb598b1a72a096ac9b14ce2c591e988f9995e2ede0ab4d60e
BLAKE2b-256 checksum
How to use checksums
7762cf8a17d20156cee907fafa2c555ab172ac0ebae47277df8f5210d70d4633
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.18

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files

0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page