TinyVM is a small, fast, lightweight virtual machine written in pure ANSI C.

Overview
TinyVM is a virtual machine with the goal of having a small footprint.
Low memory usage, a small amount of code, and a small binary.

Building can be accomplished on UNIX-like systems with make and GCC.

There are no external dependencies, save the C standard library.

Building can be accomplished using "make," or "make rebuild".

To build a debug version, add "DEBUG=yes" after "make". To build a binary with
profiling enabled, add "PROFILE=yes" after "make".

I can be reached at "joseph.kogut(at)gmail.com"
Issues
  • Modify htab to have generic function names, and find to be nonredundant.

    Modify htab to have generic function names, and find to be nonredundant.

    This addresses @GenTiradentes' note at the end of #27. It's relatively small.

    • htab_find_core is a static method that finds a node based on the key and returns a pointer to the node or NULL
    • htab_ find calls this and returns the value of that node, or -1 if it was not found
    • htab_find_ref calls this and returns the valptr of that node, or NULL if it was not found
    opened by turnage 11
  • Implementation for Preprocessor Defines

    Implementation for Preprocessor Defines

    I've done some work on the defines item in the TODO. It is a big pull request, and I mostly did it this way so that all the changes were easily viewable. I can isolate changes and provide patch files where needed if this fork is to be merged.

    Valgrind ~~likes~~ fails to reject it, and a test file is included in programs/tinyvm/preprocessor, linked here.

    What I've been doing for my tests is

    make clean && make DEBUG=yes
    valgrind --leak-check=full -v bin/tvmi programs/tinyvm/preprocessor/define.vm
    

    in case recreating those steps is necessary in figuring something out.

    I was rather unsure of the decision to make an entirely new structure for storing strings, but my intention, if you like this direction, was to also use it for storing variable names when adding the feature to define bytes, words, and double words.

    Thanks ahead of time for taking a look! This has been a fun virtual machine to learn assembly on.

    opened by turnage 11
  • i have a complier error,please help

    i have a complier error,please help

    my environment is macos , when i make.

    clang src/tvmi.c -ltvm -Wall -pipe -Iinclude/ -std=gnu11 -Werror -pedantic -pedantic-errors -O3 -Llib/ -o bin/tvmi

    ld: library not found for -ltvm

    clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [tvmi] Error 1

    opened by CCbird 6
  • Fix hash collisions

    Fix hash collisions

    Hi,

    I read about hashtables in K&R. It seems avoiding collisions is fairly easy.

    I have used the technique of "Separate chaining" here (http://en.wikipedia.org/wiki/Hash_table#Separate_chaining).

    (that might be exactly the same as the technique shown in K&R, I'm not sure).

    I hope you find the code isn't too messy :)

    I've tested it by running a program that actually hash-collided on my machine, and also by changing the hash function to always return the same hash.

    opened by bl0ckeduser 4
  • Add hash-collision demo program

    Add hash-collision demo program

    The included program contains two labels that should hash to the same value on x86 or amd64 (i.e. 32-bit or 64-bit PC hardware).

    Running it with the original hash table code prints out the error "Label 'verdict' defined twice".

    opened by bl0ckeduser 2
  • Changing actual tab characters with escaped ones

    Changing actual tab characters with escaped ones

    With some editors, these actual tab characters are implicitly replaced with spaces, causing the lexer to break on the next compilation. These changes may need to be applied to the other branches.

    opened by kksym 2
  • I got this ported to my OS.

    I got this ported to my OS.

    without modifying one line of codes. https://github.com/chillancezen/ZeldaOS/tree/master/application/tinyvm

    I do realize how portable the code written with ANSI C is. much appreciated!

    opened by chillancezen 1
  • How to run the program?

    How to run the program?

    I have successfully build the program , but how can I run it. I am on linux mint. Every time I try ./tvmi it gives the following error File was not found, or does not exist. Unable to interpret.

    opened by dragon540 1
  • Scan build fixes

    Scan build fixes

    This fixes a number of diagnostics which were shown with scan-build make on a Debian Stretch system (clang version 3.8.1-24).

    Testing performed: at each ref, the software compiles, and ./bin/tvmi programs/tinyvm/euler/euler1.vm produces the same output.

    opened by jepler 1
  • tvm_vm_create() fixed

    tvm_vm_create() fixed

    Removed filename parameter in tvm_vm_create() definition (its declaration doesn't contain this parameter). Fixed possible NULL pointer dereferencing in tvm_vm_create() function.

    opened by eldev 1
  • Make program objects track defines.

    Make program objects track defines.

    Program objects will now track defines. The htab for defines will be passed to the parser module in future committs, which will scan and replace any instances of the defined string.

    Possible modifications in future commits:

    • Do not use an htab for defines; rather a list of structs with a key/val
    • Use the integer value allocated for htab elements as a pointer to the value string instead of an integer.
    opened by turnage 1
  • Love this project.  Get rid of the preprocessor?

    Love this project. Get rid of the preprocessor?

    Even the newer C++ standards have lareayd decided the preprocessor for C is now just "part of the language" Maybe find a way to integrate that?

    opened by WarlockD 0
  • Minor update and added VS solution.

    Minor update and added VS solution.

    Changed: process_defines now uses a calloc'd tempstr like process_includes. Using a variable-length array was the only barrier for the MS compiler.

    Added Visual Studio solution and project files.

    opened by yuppox 0
  • Comments.

    Comments.

    Please comment this code. It looks like a really excellent project for learning about virtual machines but people wont use it that way if its a pain to figure out whats going on.

    If not comments then please provide documentation.

    opened by technetos 7
Owner
Joseph Kogut
Joseph Kogut
A very minimal type-2 hypervisor built using Linux Kernel Virtual Machine for Linux.

wiser A very minimal type-2 hypervisor built using Linux Kernel Virtual Machine for Linux. Following project is under-development expect unfinished co

flouthoc 249 Jul 26, 2022
kvm-host is a minimalist type 2 hypervisor using Linux Kernel-based Virtual Machine (KVM), capable of running Linux kernel partially.

kvm-host kvm-host is a minimalist type 2 hypervisor using Linux Kernel-based Virtual Machine (KVM), capable of running Linux kernel partially. Build a

null 68 Jul 3, 2022
A virtual machine hardware tool that gives you an escape option for when your VM locks you in (when it freezes, and also traps your mouse).

A virtual machine hardware tool that gives you an escape option for when your VM locks you in (when it freezes, and also traps your mouse). A secondary mouse that only activates once you press it.

Sean P. Myrick V19.1.7.2 1 Oct 25, 2021
A virtual processor with a unique instruction set written in C++

Processor-Project A virtual processor with an instruction set similar to ARM made in C++. How it works This virtual processor allows the user to write

null 20 May 27, 2022
A C program to retrieve information about your Linux machine

Reporter A C program to retrieve information about your Linux machine How to Install Open the terminal and type following commands apt update apt inst

Sc1r3Cr0w 5 Jun 14, 2022
kvm based x86 partitioned hypervisor written in cpp

mumu is a hobby hypervisor-ish. mumu can be a good resource to learn virtualization, hypervisors and KVM right now. In the future, who knows, it may become a real hypervisor.

Musa Ünal 6 Oct 9, 2021
A modern dynamically typed programming language that gets compiled to bytecode and is run in a virtual machine called SVM (Strawbry Virtual Machine).

Strawbry A bytecode programming language. Here is what I want Strawbry to look like: var a = 1 var b = 2 var c = a + b print(c) func sqrt(x) { re

PlebusSupremus1234 6 Jan 5, 2022
Professor Terence Parr has taught us how to create a virtual machine Now it is time to pwn virtual machine

My First real world CTF Simple Virtual Machine Challenge description Professor Terence Parr has taught us how to create a virtual machine Now it is ti

null 1 Feb 17, 2022
Read file to console, automatically recognize file encoding, include ansi, utf16le, utf16be, utf8. Currently output ansi as gbk for chinese text search.

rgpre A tool for rg --pre. Read file to console, automatically recognize file encoding, include ansi, utf16le, utf16be, utf8. Currently output ansi as

null 3 Mar 18, 2022
A virtual machine for executing programs written in Hack.

HHVM HHVM page | HHVM documentation | Hacklang page | General group | Dev group | Twitter HHVM is an open-source virtual machine designed for executin

Meta 17.3k Jul 31, 2022
A virtual network Differential GNSS server-client project using Precise Point Positioning (PPP). Global coverage. Without physical base station construction needed. An open-source virtual base station approach.

Virtual-Network-DGNSS-Project This project is the software implementation for a publicly available, open-source, client/server VN-DGNSS implementation

null 10 May 20, 2022
A lightweight, portable pure C99 onnx inference engine for embedded devices with hardware acceleration support.

Libonnx A lightweight, portable pure C99 onnx inference engine for embedded devices with hardware acceleration support. Getting Started The library's

xboot.org 409 Jul 26, 2022
Microshell - a lightweight pure C implementation of shell emulator dedicated for embedded bare-metal systems.

MicroShell Lightweight pure C implementation of virtual shell, compatible with VT100 terminal. Support root tree, run-time mounting paths, global comm

Marcin Borowicz 90 Aug 4, 2022
ThreadPool - Lightweight, Generic, Pure C++11 ThreadPool

ThreadPool Lightweight, Generic, Pure C++11 ThreadPool Rational I needed a Thread Pool for something I was writing, and I didn't see any that I liked.

Neil 262 Jul 19, 2022
Very low footprint JSON parser written in portable ANSI C

Very low footprint JSON parser written in portable ANSI C. BSD licensed with no dependencies (i.e. just drop the C file into your project) Never recur

James McLaughlin 1.2k Jul 28, 2022
Semantic version library written in ANSI C

semver.c Semantic version v2.0 parser and render written in ANSI C with zero dependencies. Features Standard compliant (otherwise, open an issue) Vers

Tom 169 Aug 1, 2022
JSFuck obfuscator written in ANSI C.

jsfuck.h JSFuck obfuscator written in ANSI C. For more info/context, visit www.jsfuck.com. Tested on MinGW (Windows) and GCC (Linux, Ubuntu). Build To

4 Jun 11, 2022
ASMotor is a portable and generic assembler engine and development system written in ANSI C99

ASMotor is a portable and generic assembler engine and development system written in ANSI C99 and licensed under the GNU Public License v3. The package consists of the assembler, the librarian and the linker. It can be used as either a cross or native development system.

null 40 Jul 28, 2022
Very low footprint JSON parser written in portable ANSI C

Very low footprint JSON parser written in portable C89 (sometimes referred to as ANSI C). BSD licensed with no dependencies (i.e. just drop the C file

null 1.2k Jul 28, 2022
This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain

This is a minimal state immediate mode graphical user interface toolkit written in ANSI C and licensed under public domain. It was designed as a simple embeddable user interface for application and does not have any dependencies, a default render backend or OS window and input handling but instead provides a very modular library approach by using simple input state for input and draw commands describing primitive shapes as output.

Micha Mettke 13.4k Aug 4, 2022
A tiny, portable, immediate-mode UI library written in ANSI C

A tiny, portable, immediate-mode UI library written in ANSI C Features Tiny: around 1100 sloc of ANSI C Works within a fixed-sized memory region: no a

null 2.3k Aug 8, 2022
Simple Virtual Machine with its own Bytecode and Assembly language.

BM Simple Virtual Machine with its own Bytecode and Assembly language. Build We are using nobuild build system which requires a bootstrapping step wit

Tsoding 77 Aug 3, 2022
RISC-V Virtual Machine

RVVM - The RISC-V Virtual Machine RISC-V CPU & System software implementation written in С What's working OpenSBI, custom firmwares boot and execute p

LekKit 262 Jul 22, 2022
NDS port of the uxn virtual machine

uxnds Quick and simple port of the uxn virtual machine to the NDS console. By default, uxnds will run /uxn/boot.rom. It also supports reading files fr

Adrian Siekierka 102 Jun 16, 2022
Microvm is a virtual machine and compiler

The aim of this project is to create a stack based language and virtual machine for microcontrollers. A mix of approaches is used. Separate memory is used for program and variable space (Harvard architecture). An interpreter, virtual machine and compiler are available. A demostration of the interpreter in action is presented below.

null 11 Jun 21, 2022
Web runtime for the uxn virtual machine.

webuxn A light-weight port of the uxn virtual machine to the web via WebAssembly. Demos life.rom darena.rom animation.rom musictracker.rom Bring Your

Bruno Garcia 54 Jul 26, 2022
WasmEdge Runtime is a high-performance, extensible, and hardware optimized WebAssembly Virtual Machine for automotive, cloud, AI, and blockchain applications.

WasmEdge Runtime is a high-performance, extensible, and hardware optimized WebAssembly Virtual Machine for automotive, cloud, AI, and blockchain applications.

null 3.6k Aug 8, 2022
A port of the Uxn virtual machine to the ESP32

Uxn An assembler and emulator for the Uxn stack-machine, written in ANSI C. Build Linux To build the Uxn emulator, you must have SDL2. If you wish to

Maxime ANDRÉ 27 Mar 24, 2022
A very minimal type-2 hypervisor built using Linux Kernel Virtual Machine for Linux.

wiser A very minimal type-2 hypervisor built using Linux Kernel Virtual Machine for Linux. Following project is under-development expect unfinished co

flouthoc 249 Jul 26, 2022