/COVM

A lightweight x86/x64 VM

Primary LanguageC#GNU General Public License v2.0GPL-2.0


logo
COVM

(In-progress) A lightweight, stack-based/register-based and assembly-like x86/x64 VM.

Why COVM?

The goal of this project is use the virtualization power to provide a safe encryption used in the network communication.

Organs of COVM

  • COVM Compiler
    • The compiler turns the virtual-machine files into a runable bytecode.
  • COVM Interpreter
    • The interpreter runs the bytecode generated by the compiler.
  • COVM IDE
    • The integrated development environment provides an easy way to create virtual-machine files to adjust the complexcity and instructions.

Supported operations

  1. NOP - An operator that does nothing.
  2. ADD - Adds a number to a register
  3. SUB - Subtracts a number inside a register
  4. MUL - Multiplies a number inside a register with x
  5. DIV - Divides a number inside a register with x
  6. AND - Bitwise AND
  7. XOR - Bitwise XOR
  8. OR - Bitwise OR
  9. NOT - Bitwise NOT
  10. INC - Increases the number by one inside a register
  11. DEC - Decreases the number by one inside a register
  12. RET - Jumps to the end of the function
  13. MOV - Moves data into a register
  14. PUSH - Pushes data into the stack
  15. POP - Removes data from the stack
  16. LSTART - Defines the start of a function
  17. LEND - Defines the end of a function
  18. CALL - Calls a function by index
  19. JMP - Jumps to an instruction
  20. CMP - Compares register to any given data (register or hard-coded value)
  21. JT - Jumps if the above check was true
  22. JNT - Jumps if the above check was false

more will be added later.

Registers

Registers do not have a fixed size, but it is recommended to split them like the following:

  • 16 bit-registers: AX, BX, CX, DX
  • 32 bit-registers: EAX, ECX, EDX, EBX, ESP, EBP, ESI, EDI
  • 64 bit-registers: RAX, RCX, RDX, RBX, RSP, RBP, RSI, RDI (R8, R9, ...)
  • 128-bit-registers...
  • ...

Flags

Currently the COVM does not make use of flags, here are ones planned for the future usage:

  1. CF
  2. PF
  3. AF
  4. ZF
  5. TF
  6. IF
  7. DF
  8. OF
  9. CTF

Compiling

You need Visual Studio to compile COVM.

License

COVM is licensed under GPLv2, which means you can freely distribute and/or modify the source of COVM.