Xen-based unikernel in Rust
crust-os / crust-os Goto Github PK
View Code? Open in Web Editor NEWXen-based unikernel in Rust
License: MIT License
Xen-based unikernel in Rust
License: MIT License
newlib expects 17 system calls to be defined in order to build. Not all of them need to be functional; for example, we can push back implementation of execve
and fork
until we actually start thinking about process management.
_exit
, write
and sbrk
should be implemented right away. For the other syscalls, the newlib documentation provides trivial implementations that just return error values; good enough for now?
rustc
can target several different libc implementations. However, newlib is currently unsupported.
Adding support for musl was a week-end project for compiler hacker @alexcrichton. We can add support for newlib by following his example.
Chapter 7.10 of the book has information on the subject.
For demo day.
Rust implements "panics" (equivalent to C++ exceptions). They're used throughout the standard library, including when allocating memory through Box::new
.
To support panics, we need to implement ::rt::begin_unwind
and possibly ::rt::begin_unwind_fmt
. A good first implementation would print to the emergency console and immediately crash.
Enables:
We got our metaphors wrong, and our STACK_BOTTOM is a higher number than our STACK_TOP.
Two changes:
.lds
linker scriptmov $STACK_TOP, %rbp
in start.SThis is a longer-term goal, we still need to agree on a strategy for documenting code.
We should use cargo doc
on our code base (see here) and publish the results online.
Necessary to implement device discovery. Chapter 8 of the book.
ELF files have a PT_INTERP
section specifying what "interpreter" should be used to run them, if any. The default is usually something like /lib/elf/ld-linux.so.1
, but it wouldn't be too hard to point to a script somewhere (/etc/crust/run
, for example) which just calls xl create -c /etc/crust/crust.cfg 'name="$(RANDOM_GUID)"' 'kernel="$1"'
.
Using __HYPERVISOR_sched_op
.
Should print to the emergency console. Not necessarily urgent.
Depends on:
Supporting libstd
would let us take arbitrary Rust code (modulo asm!
, #[cfg(target_os = "linux")]
, etc.) and compile it to run on Crust.
The vast majority of crates (libraries, etc.) in the Rust ecosystem depend on libstd
. Users should be able to write programs for Crust that depend on third-party crates.
There's some important functionality in src/xen/arch/x86_64/mem.rs
that's slightly sketchy. It'd be good to look it over, and link to resources on the topic where relevant.
start_info_page
is currently being passed into main
, but that's incompatible with the typical signature for main as int main(int argc, char** argv)
. It should be made a global variable instead.
Enables: #24
We're almost certainly going to need a cross-compiler targeting something like i686-elf. This page is a good start.
Integrating LWIP would allow us to add networking, without implementing all networking ops from scratch. As this is what Mini-OS uses, it appears to be a viable alternative.
Implement virtio
driver support.
Before calling main
, there are quite a few subsystems we need to initialize. The bootloader in boot/start.S
should call a prologue function, which should itself call main
after performing initialization.
Would enable the use of cargo test --no-run
for unit tests and cargo bench --no-run
for benchmarks.
Requires:
Crust needs heap allocation.
Requires:
We've already implemented support for printing to the Hypervisor console (also called "debugging console" or "emergency console"), which can be read via xl dmesg
. However, it would be nice to support printing to the guest console, if only as a way to provide a meaningful stdout
for Crust applications.
Requires:
#22
Rust enums can be represented in memory as either scalar types or as the default representation for C enums on that platform. The latter is almost never correct, and it should be replaced with the appropriate value.
On one hand, Mini-OS uses some kind of compiler flag voodoo to build Xen images without a cross-compiler. On the other, Newlib's build system is notoriously finicky, and it's usually built with a cross-compiler.
Let's bridge that gap somehow and get Newlib and Mini-OS to compile together into a Xen image.
Not having a debugger is pretty problematic.
Minimal reproduction on Xen 4.6.0 debug build
Xen's "shared info page" is used to communicate to VMs important information related to concurrency, time-keeping, memory management, and event handling.
We need to determine what to use for the Stack and Heap size.
Currently, if we extend the size of the heap too much, we get a general protection fault while trying to allocate memory
Big push to make further work more manageable.
Can be done in crust.cfg
or as a command line argument to xl
by setting the cmdline
field (see here).
Requires:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.