/min-vm

Primary LanguageC

Min-VM : Small virtual machine

This repo contains the virtual machine that runs min bytecode.It can run the bytecode produced by min-cc.

Usage

usage: min-vm [--run/--debug/--tracing] <file>

        --run   : Simply runs the specified binary
        --debug : Run the program with debug output
        --tracing : Run the program with debug + trace

Assemble a .min file

If you want for whatever reason to compile some min assembly, you can use the compiler here

Instruction coverage

  • r = reg
  • a = addr
  • n = number
  • Instructions :
    • add {r} {r,n}
    • sub {r} {r,n}
    • mul {r} {r,n}
    • mov {r} {r,n,a}
    • ldr {r} {r,a}
    • ldrb {r} {r,a}
    • str {r} {r,a}
    • strb {r} {r,a}
    • push {r}
    • pop {r}
    • cmp {r} {r,n}
    • jmp {a}
    • jne {a}
    • je {a}
    • jle {a}
    • jbe {a}
    • sys
    • xor {r} {r,n}
    • and {r} {r,n}
    • or {r} {r,n}
    • shr {r} {r,n}
    • shl {r} {r,n}

Disassembly

You can use the disassembler plugin in the r2-plugin folder to disassemble min bytecode with radare2. To being able to build it you must first compile the min-vm project. Then build and install the plugin using the following commands.

$ cd r2-plugin/
$ make
$ make install
# use "e asm.arch = min" in r2 or launch r2 with "r2 -a min <file.mx>"

Code analysis and binary loading plugins are not implemented for now but will be in the future.