The Resurgence VM, a register virtual machine designed for simplicity and ease of use, based on the old Rendor VM

Related tags

Emulators Resurgence
Overview

Resurgence

Test Test Crates.io version shield Docs Crates.io license shield

Join the Discord server!

Discord

Resurgence aims to be an embeddable virtual machine with an easy-to-use API for projects like:

  • Game engines
  • Language interpreters
  • Applications that want custom scripting behavior
  • Applications that want to execute custom user code securely

Right now, Resurgence is currently in early stages of development, and shouldn't be used in any serious projects yet.

Note: Resurgence is just a virtual machine. This allows us to focus on making it good without having to worry about maintaining a language interpreter or library interface. For making a fully featured interpreter, we recommend Crafting Interpreters to get an idea on how to make one.

Features

  • Resurgence is a Register-based VM, which closely replicates the design of a real computer
  • Resurgence is designed to be very lightweight and simple
  • Resurgence is designed specifically for embedding into another application
  • Code running inside Resurgence is sandboxed by default

Architecture

Architecture Application Stack

Security

Code running inside of a Resurgence VM is secure and sandboxed by default. The embedding application must explicitly register functions for any instructions to call external code. This essentially sandboxes code running inside of a VM to have a limited ability to access system features. Resurgence is also written using safe Rust code, which makes it extremely difficult to escape this sandbox. This design makes Resurgence suitable for executing untrusted user code without compromising security.

Note: Dynamic loading is not supported by Resurgence. However, it could be implemented by the embedding application.

Building Docs

To get basic documentation, run:

cargo doc --open

If you want documentation for internal implementation stuff (yes, we document the internals), run:

cargo doc --open --document-private-items

Comments
  • C API

    C API

    As part of Resurgence's goals, a C API is planned to allow the VM to load C libraries. This will require a few things:

    1. An API design. Personally, I think we could make an API similar to Lua's C API.
    2. A way to load a module. This needs to be done in a way that also allows easy access to the functions loaded in the Resurgence Embedding API.
    3. A way to call functions from the module. This should not be too slow, but it should also be simple to understand.

    I'll be assigning this to @dynafide. The c_api branch has already been created for this task

    enhancement Resurgence Planned Feature 
    opened by StandingPadAnimations 3
  • `Cardinal` and decoupling `RunTimeSeal`

    `Cardinal` and decoupling `RunTimeSeal`

    The idea is to decouple RunTimeSeal from the interpreter and replace it with Cardinal. Cardinal wraps around the interpreter process and acts like a simple kernel, handling extension calls and all that

    Pros:

    • Easier to secure
    • Simpler to understand then RunTimeSeal
    • Implementing things like permissions is a piece of cake and doesn't require much refactoring of the interpreter Cons:
    • Massive refactoring needed
    • Removal of some bytecode instructions
    • ExtCall needs to be replaced with some sort of system instruction
    enhancement 
    opened by StandingPadAnimations 1
  • Finish code generation interface

    Finish code generation interface

    We need to finish implementing the codegen (Code Generation) API for compilers to use to simplify the process of generating bytecode. This will help eliminate the need to rewrite the code generator and manually outputting the byte code format byte-for-byte. This will also help simplify the effort to rewrite our RASM assembler program in Rust.

    enhancement Resurgence Planned Feature 
    opened by dynafide 1
  • Bytecode Reader and Writer

    Bytecode Reader and Writer

    A reader and writer mechanism will be needed for storing and transmitting byte code. I'm currently working on this, so I'm assigning myself to the issue.

    enhancement Resurgence Planned Feature 
    opened by dynafide 1
  • Add imports table to bytecode format

    Add imports table to bytecode format

    This pull request adds the planned imports table into the bytecode reader and writer code as part of issue #5. I am unable to fully test this change right now, but everything should work.

    opened by dynafide 0
  • Add core dumps

    Add core dumps

    Add a crash / core dumps mechanism that can either be triggered manually or when faults occur. This will help with debugging both the Resurgence VM as well as programs running inside of it. Core dumps should contain the following:

    • a copy of the instructions and bytecode header re-encoded from the Codeholder
    • a list of the states of each recursive execute_instruction call, including the register values and the current instruction number they are at
    • a complete copy of all stack frames
    • a complete copy of the stack

    This should be output in a portable binary format that can be used in other applications for debugging purposes.

    enhancement Resurgence Planned Feature 
    opened by dynafide 0
  • Seccomp support

    Seccomp support

    It may be a good idea to add seccomp support to Resurgence to further enforce secure computing. I see two ways we could implement this feature:

    The first way we could implement it would look something like this:

    • When the interpreter instance is created, it also creates a new seccomp thread that listens on an internal IPC interface, such as shared memory or a FIFO pipe
    • Whenever any future calls are made to the interpreter, they are forwarded to the seccomp thread over the IPC interface
    • When the interpreter instance is destroyed, it ends the seccomp thread

    This way, the seccomp functionality is completely internal to Resurgence and is abstracted away from the host application entirely.

    We could also implement it the second way, which would look something like this:

    • Resurgence provides some sort of seccomp_enable and seccomp_disable functions in the API
    • The host application directly sets up and tears down the seccomp thread and runs the entire Resurgence VM inside of it

    This would be more secure, but would make it much more difficult to use for developers of host applications.

    enhancement 
    opened by dynafide 0
  • Checklist for Alpha 0.2.0

    Checklist for Alpha 0.2.0

    This checklist is the stuff left for the first alpha release of Resurgence:

    • [ ] #8
    • [ ] #9
    • [x] #15
    • [ ] Finish C FFI (including returning errors instead of just status)
    • [x] Make sure @dynafide adds himself to Cargo.toml
    • [x] Add drop to stack methods for the Rust and C APIs ~~- [x] Make sure RunTimeSeal can catch most if not all attempts of tampering the runtime (this will definitely not be finished by the first alpha, but we can try our best)~~ EDIT: RunTimeSeal will be removed as it doesn't bring much benefit
    • [ ] Publish on Crates.io
    • [x] Update diagrams in README
    • [ ] Port RASM to Rust (requires code gen API to be finished)
    • [x] Make sure that RASM can compile all instructions
    • [x] BIG ONE: add Global support for FrameAlloc and FrameFree
    • [x] Make sure function visibility is correct (internals should not be usable to the end user)

    @dynafide anything else we need to check off before we release alpha 0.2.0?

    opened by StandingPadAnimations 8
  • Improve verbosity of errors

    Improve verbosity of errors

    To improve the descriptiveness of runtime errors and faults, we should modify the error handling in some way which allows the calling application to trace the call stack and determine the instruction that triggered a fault. Some information about the state of registers and the stack (similar to a core dump) would also be useful.

    This will help users debug RVM code as well as enable us to find flaws in the VM itself.

    enhancement 
    opened by dynafide 2
  • Improve code stability

    Improve code stability

    In order to improve the stability of Resurgence as a library, all calls to panic!() .unwrap() and todo!() should be rewritten to pass results to the calling application. I'm creating this issue to keep track of progress.

    bug 
    opened by dynafide 3
TestSuite4 is a framework designed to simplify development and testing of TON Contracts. It includes light-weight emulator of blockchain making it easy to develop contracts.

TestSuite4 0.1.2 TestSuite4 is a framework designed to simplify development and testing of TON Contracts. It contains lightweight blockchain emulator

TON Labs 26 Feb 3, 2022
A stack (ram) based language written in rust

The Ram programming language A stack based programming language created to experiment my crappy lang-dev only capable of making some mathematical form

Ujjwal Kumar 24 Nov 17, 2022
Site frequency spectrum estimation based on window expectation-maximisation algorithm

winsfs winsfs is a tool for inference of the site frequency spectrum ("SFS"). Quickstart Assuming SAF files have already been made, default estimation

Malthe Sebro Rasmussen 8 Nov 1, 2022
An RP2040-based ROM emulator

PicoROM PicoROM is an 8-bit ROM emulator in a DIP-32 compatible form factor. It's main use case (the reason I made it) is for rapid iteration when exp

Martin Donlon 42 Jul 12, 2023
A Game Boy research project and emulator written in Rust

Mooneye GB Mooneye GB is a Game Boy research project and emulator written in Rust. The main goals of this project are accuracy and documentation. Some

Joonas Javanainen 802 Dec 28, 2022
RustBoyAdvance-NG is a Nintendo™ Game Boy Advance emulator and debugger, written in the rust programming language.

RustBoyAdvance-NG Nintendo GameBoy Advance ™ emulator and debugger, written in rust. WebAssembly Demo: https://michelhe.github.io/rustboyadvance-ng/ P

MishMish 510 Dec 30, 2022
Learn emulator and programming languages, target chip8, nes, gbc, gba ...

[WIP]learn emulator go-chip8 go run main.go source https://en.wikipedia.org/wiki/CHIP-8 http://devernay.free.fr/hacks/chip8/C8TECH10.HTM https://githu

早晨海风 4 Apr 30, 2021
A game about evolution, cooperation, and predation

Biomass Breakout Backstory An ark has crash landed on the failed colony of Vivemortis, which humans had tried and failed to tame. As it crashes, the t

Samuel Schlesinger 1 Dec 5, 2021
Rust crate for embedding, manipulating and retrieving data embedded in binaries using linker sections

linkstore is a library that allows you to define global variables in your final compiled binary that can be modified post-compilation.

William 5 Nov 18, 2022
A NES emulator written in Rust, with a focus on expandability and accuracy

A NES emulator written in Rust, with a focus on expandability and accuracy

Benjamin Mordaunt 4 Sep 19, 2022
Unicorn Emulator Debug Server - Written in Rust, with bindings of C, Go, Java and Python

udbserver - Unicorn Emulator Debug Server When you do emulation with Unicorn Engine, do you want to inspect the inner state during every step? udbserv

Bet4 246 Dec 27, 2022
Learning Rust and ECS by implementing an emulator for Silkroad Online.

Skrillax Learning Rust and ECS by implementing an emulator for an MMORPG. Skrillax is my learning project for playing around with Rust, learning about

Tim Hagemann 10 Dec 22, 2022
SCEMU The crates.io lib, x86 cpu and systems emulator focused mainly for anti-malware

SCEMU Usage Download the maps32.zip or maps64.zip from: https://github.com/sha0coder/scemu/releases/download/maps/maps32.zip https://github.com/sha0co

sha0coder 11 Dec 25, 2022
🥔 MOS-6502 and NES emulator in Rust (SDL/WebAssembly)

?? Potatis /mos6502 - Generic CPU emulator. Passes all tests, including illegal ops. (No BCD mode). /nes - A very incomplete NES emulator. /nes-sdl -

Henrik Persson 28 Jan 9, 2023
Emulator and debugger for LPRS1 ISA & CPU

About LPRSemu is a simple emulator and debugger for LPRS1 ISA & CPU. It supports loading programs from assembly text files, binary string representati

Filip Parag 3 Jan 8, 2023
A hardware-accelerated GPU terminal emulator powered by WebGPU, focusing to run in desktops, browsers, tvs and everywhere.

Rio term tl;dr: Rio is a terminal built to run everywhere, as a native desktop applications by Rust/WebGPU or even in the browser powered by WebAssemb

Raphael Amorim 208 Apr 24, 2023
Ember is a minimalistic Rust library for creating 2D graphics, games, and interactive visualizations with ease and simplicity.

Ember Ember is a simple and fun 2D rendering library for Rust, allowing you to quickly create graphics and interactive applications with ease. It uses

null 8 May 4, 2023
Easy c̵̰͠r̵̛̠ö̴̪s̶̩̒s̵̭̀-t̶̲͝h̶̯̚r̵̺͐e̷̖̽ḁ̴̍d̶̖̔ ȓ̵͙ė̶͎ḟ̴͙e̸̖͛r̶̖͗ë̶̱́ṉ̵̒ĉ̷̥e̷͚̍ s̷̹͌h̷̲̉a̵̭͋r̷̫̊ḭ̵̊n̷̬͂g̵̦̃ f̶̻̊ơ̵̜ṟ̸̈́ R̵̞̋ù̵̺s̷̖̅ţ̸͗!̸̼͋

Rust S̵̓i̸̓n̵̉ I̴n̴f̶e̸r̵n̷a̴l mutability! Howdy, friendly Rust developer! Ever had a value get m̵̯̅ð̶͊v̴̮̾ê̴̼͘d away right under your nose just when

null 294 Dec 23, 2022
Loopers is graphical live looper, written in Rust, designed for ease of use and rock-solid stability

Loopers Loopers is a graphical live looper, written in Rust, designed for ease of use and rock-solid stability. It can be used as a practice tool, com

Micah Wylde 81 Dec 29, 2022
Dc improved: Feature-added rewrite of a 50+ year old RPN calculator/stack machine/programming language

dcim [WIP] dc improved: Feature-added rewrite of a 50+ year old RPN calculator/stack machine/programming language This readme is currently incomplete.

null 3 Jun 18, 2022