Dazo-org/zerovm — Issue #5: ZRT => ZeroVM Runtime
Author: camuel
Created: 2011-11-29 13:46:35+00:00
State: open
Labels: CRITICAL, FEATURE

Runtime system must be created for ZeroVM. Initial design is as follows:

1. On bare ZeroVM (which is bare metal :)) SQLite and newlib will be run.
2. SQLite can be configured without needed any OS calls at all and querying through provided dynamically VFS interfaces. SQLite also needs malloc/free implementation but this can be also cancelled and SQLite can be provided with just memory chunk and it will manage its own memory management there and even this functionality is further exported. SQLite also requires thread-sync primitives but that also can be canceled with compiling SQLite without threading support. So VFS implementation is just enough and can be provided dynamically so for just compiling SQLite nothing is expected in terms of OS syscalls.
3. Newlib expects 17 syscalls to function properly. All 17 syscalls must be implemented as 100% untrusted code inside ZeroVM.
4. Part of those 17 calls are file system API which is not trivial to implement. One solution could be by using libsqlfs file system, another could be finding minimal in-memory file-system implementations. This file-system is expected to have only marginal use and also included for completeness of C99.
5. Newlib will provide full C99 compatibility with SQLite providing additional querying functionality for relational data as well as any other data to which virtual table interface could be created.
6. On top of that we will port full Lua to provide easy scripting without resorting each time to custom GNU toolchain. Lua is very easy to port to ZeroVM and also very easy and _robust_ to mix with C code.

So the SQLite+libsqlfs+newlib+Lua completes ZRT stack for now. Again all of the code without exception is implemented as untrusted code. However, SQLite can be run on input/output data by dynamically providing VFS that uses zvm_read and zvm_write syscalls.

In addition to above mentioned stack, ZRT also implements a number of convenience functions like parsers and generators for manifests and syscall wrappers and etc..