The Twizzler Operating System

Overview

The Twizzler Operating System

Twizzler is a research operating system designed to explore novel programming models for new memory hierarchy designs. We are focused on providing an environment designed around invariant data references and long-lived pointers, thus being well suited for byte-addressible non-volatile memory and multi-node networked applications.

This repo contains source code for the kernel and userspace, along with a build system that bootstraps a Twizzler userspace. You can write code for it and play around! We're not quite production ready, but we're getting there! :)

See (https://twizzler.io/about.html) for more details.

NOTE: This repo has recently been rebuilt with our pure Rust implementation of the Twizzler kernel. If you have previously forked or used Twizzler you may find that some features are changed or not at parity. Please open an issue on our tracker if you find any deficiencies.

Building

See BUILD.md for details.

Contributing

See develop.md for details.

Reporting Bugs

All bugs found and features requested must be reported through our github issue tracker. Please add the appropriate label, bug or feature, and also give as much detail as possible, including backtraces or such for bugs.

If you find a security vulnerability that needs responsible disclosure please contact the administrators of the project directly and we will work with you on the fix and the disclosure credit.

Code of Conduct

See conduct.md for details.

A Tour of the Repo

<root>
    doc -- documentation files
    src
        bin -- Twizzler userspace programs
        kernel -- the Twizzler kernel itself
        lib -- libraries for Twizzler
    target (once built) -- compilation artifacts
    toolchain -- sources for all aspects of the Rust toolchain used to build Twizzler
        install (once built) -- install location for the toolchain
        src -- sources for the toolchain
            rust -- cloned repo for Rust, modified for Twizzler userspace
    tools -- build tools, like the build system orchestrator xtask
Comments
  • Qemu crashes soon after Limine boots on a fresh Ubuntu 20.04 install

    Qemu crashes soon after Limine boots on a fresh Ubuntu 20.04 install

    Following directions in doc/src/BUILD.md, everything went fine until: cargo start-qemu

    then I get:

    BdsDxe: failed to load Boot0001 "UEFI QEMU DVD-ROM QM00005 " from PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x2,0xFFFF,0x0): Not Found BdsDxe: loading Boot0002 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0xFFFF,0x0) BdsDxe: starting Boot0002 "UEFI QEMU HARDDISK QM00001 " from PciRoot(0x0)/Pci(0x1F,0x2)/Sata(0x0,0xFFFF,0x0)

    right as Limine's interface comes up in qemu . . . Limine then boots automatically and the following:

    Screenshot from 2022-06-08 11-06-36

    is all that flashes quickly before Qemu crashes.

    the same happens with: cargo start-qemu --profile release

    I'm on a fresh install of Mint Linux 20 Cinnamon (which is based on Ubuntu 20.04). It's not a virtual machine install; it's on a Gateway ZX6900 machine.

    I don't see how to put a "Bug" Label on this Issue. I'm guessing I don't have permissions to do it? Maybe someone who does can label this "Bug".

    bug 
    opened by NateHerman 25
  • Implement simple sleep for thread_sync.

    Implement simple sleep for thread_sync.

    Implements an intended part of the thread_sync API: If an empty slice of operations is passed to thread_sync along with a timeout Duration, thread_sync will just sleep the specified amount of time, allowing for easy and efficient sub-second sleeping.

    Addresses #98

    Alternatively, we could pass a sleep operation to a local stack word that will never awaken, and thus use timeout for the same effect. This would make the in-kernel implementation slightly simpler, but would make sleeping more expensive and involve more coordination.

    bug kernel 
    opened by dbittman 3
  • Test framework for kernel (and user-level OS services)

    Test framework for kernel (and user-level OS services)

    It would be nice if we could leverage rust-standard behavior for writing things like #[test] in the kernel and in user-level OS services (for testing low-level Twizzler libraries like twizzler_abi) and integrate this with the build system so we can easily run the test framework as part of a github actions run.

    enhancement kernel build system 
    opened by dbittman 3
  • Initial work implementing Twizzler driver abstractions.

    Initial work implementing Twizzler driver abstractions.

    This (large, sorry) set of changes represents a first set of changes for implementing the driver abstractions. While this in in-progress (and thus this change set is incomplete), I wanted to start the process for merging some of this in. This set adds a significant amount of framework that will hopefully make future PRs smaller and easier to work with.

    Primary changes are in the twizzler-driver crate, the twizzler-abi crate, and in the kernel (interrupt handling and in-kernel PCIe support).

    enhancement 
    opened by dbittman 1
  • twizzler-abi stabilization series part 1

    twizzler-abi stabilization series part 1

    This set of patches is part 1 in a series that intends to stabilize the twizzler-abi crate for an initial version. We'll have to do this in steps because some parts of this crate are awaiting RFCs for their design, so can't be included yet. I'd like to get to the point where we're only adding ASAP, followed by a v1 once we can say that the core RFCs have been implemented.

    This set cleans up the syscall file by splitting it up and adds a few syscalls for object stating, deletion, etc. It also adds missing documentation for much of the crate.

    enhancement 
    opened by dbittman 1
  • Fix kernel thread-local storage allocation

    Fix kernel thread-local storage allocation

    The kernel's thread-local storage allocator only works in some limited cases. See the userspace version (src/lib/twizzler-abi/src/rt1.rs) for a better algorithm. We should use that for the kernel too.

    bug kernel 
    opened by dbittman 1
  • Update toolchain

    Update toolchain

    This PR updates the rust toolchain to 2022-10-01 nightly, up from version 1.56. This involves a rebase for all the Twizzler patches in rust, llvm, backtrace, libc, etc. We also update some of the dependencies in xtask and the kernel, and update the boot protocol (see below).

    Note that pulling in these changes will require a submodule update AND a re-execution of the cargo bootstrap command.

    The update to the boot protocol (from stivale2 to limine) is because the debug kernel is now too large (from all the debug symbols) to load by the older version of our bootloader, but the newer version doesn't support stivale2 anymore. And the upgrade to the limine protocol was fairly easy.

    Please don't merge this PR until I verify that the new futex-based mutexes are working properly (these are located in the rust repo, because they are in stdlib).

    enhancement 
    opened by dbittman 0
  • Implement kernel compilation flag for xtask build and check

    Implement kernel compilation flag for xtask build and check

    Implements -k/--kernel flag for xtask build and check. This PR does not implement this flag for start-qemu. It should be possible to, for example, only compile the kernel and then start qemu, or only run kernel tests. However, this would require changing the initrd/disk image process.

    opened by PandaZ3D 0
  • Fix bugs and papercuts in basic device driver API, and implement remaining support for user-handling of interrupts.

    Fix bugs and papercuts in basic device driver API, and implement remaining support for user-handling of interrupts.

    This PR contains a multitude of minor changes to device driver APIs that make them easier to use, and fixes bugs in the interrupt mechanism.

    First, the PR contains a bunch of testing code as I am dog-fooding an NVMe driver. That is all in nvme_test.rs, and does not need reviewing.

    The biggest changes are in interrupt handling, wherein the PCIe code is actually in-place to program MSI-x tables and allocate interrupts from the kernel. A lower level change is that now external device interrupts get enqueued for a higher soft interrupt handler to actually wake threads (since this could involve mem allocation and mutex locking).

    Otherwise, there are a number of minor API changes / additions to make working with the device APIs smoother.

    I plan to, in a separate PR, continue to dogfood and cleanup some of the code. I just wanted to get some of this in now since it includes API changes.

    enhancement 
    opened by dbittman 0
  • Implement freelist compaction for DMA pool.

    Implement freelist compaction for DMA pool.

    Finishes the DMA pool aspect of the DMA RFC ( https://github.com/twizzler-operating-system/twizzler/issues/84 ). Adds in automatic compaction of the freelist when a region is freed.

    enhancement 
    opened by dbittman 0
  • Kernel object page pinning and DmaObject + DmaRegion implementation.

    Kernel object page pinning and DmaObject + DmaRegion implementation.

    This PR implements support for pinning pages of object memory for use in DMA, and implements functions in the twizzler-driver::dma module for managing DMA objects and DMA memory regions, including managing syncing and pins. It does not include implementation of the DMA pool functions, which will be done in a future PR.

    This in an incremental PR for RFC#0006 ( #84 ).

    enhancement 
    opened by dbittman 0
  • Make time types used in kernel match up with `twizzler-abi`

    Make time types used in kernel match up with `twizzler-abi`

    In the early days of development the type Nanoseconds was used to represent the semantic time unit.

    https://github.com/twizzler-operating-system/twizzler/blob/66b8f2729afcbba0b4ab9b1e6fff2c902e42964b/src/kernel/src/clock.rs#L16-L20

    However, PR #78 introduced new time types to be used in kernel and by users. To make things coherent we should make any notion of time used in the kernel match up with those APIs. This requires a number of things:

    • [ ] replace internal usage of Nanoseconds with type exposed by twizzler-abi
    • [ ] make TimeSpan feature parity with Duration to be used as a drop in replacement
    • [ ] type safe conversion between time types (Nanoseconds) and Ticks
    opened by PandaZ3D 0
  • Tracking issue for driver model

    Tracking issue for driver model

    Tracking issue for RFC 0005 -- Driver Model PR, Rendered

    Steps

    • [ ] Implement RFC
      • [ ] Device Event Stream
      • [ ] Request manager
    • [ ] Adjust documentation
      • [ ] API docs
      • [ ] Twizzler developer guide

    Unresolved Questions

    • [ ] 1. One unresolved question is in the ergonomics of building a driver that uses all these types that reference each other. I plan to dogfood this interface by way of an NVMe driver.
    • [x] 2. Details of DMA.

    Implementation History

    • https://github.com/twizzler-operating-system/twizzler/pull/81
    enhancement 
    opened by dbittman 1
  • Tracking issue for low level device model

    Tracking issue for low level device model

    Tracking issue for RFC 0004 -- low level device model. Links: PR, Rendered

    Steps

    • [ ] Implement RFC
      • [ ] Kernel-side device tree management
      • [ ] Kernel-side device tree access
      • [ ] Userspace data structures and device abstraction
    • [ ] Complete documentation
      • [ ] API docs
      • [ ] Twizzler developer guide

    Unresolved Questions

    • [ ] 1. Is the interrupt mechanism sufficient (for now) to allow effective programming of devices?
    • [ ] 2. What is the correct security model to apply here? Probably a set a approved programs can access the device tree and that's it.
    • [ ] 3. Some PCIe devices should have their memory mapped as write-combining (framebuffers, for example), but PCIe doesn't encode this information in the BARs. We need a way for userspace to perhaps remap a BAR as WC.

    Implementation History

    • https://github.com/twizzler-operating-system/twizzler/pull/81
    enhancement 
    opened by dbittman 0
  • Create Sample Programs

    Create Sample Programs

    Create a set of sample programs that show the uses of Twizzler. These should also be integrated into the test suite so that we know that Twizzler is working even after changes.

    enhancement 
    opened by gvnn3 0
  • Getting Started Guide

    Getting Started Guide

    Expand on our BUILD docs to explain to people how to get started using Twizzler as an OS in their own projects, as well as how to work on Twizzler itself.

    documentation 
    opened by gvnn3 0
Owner
null
Writing an OS in Rust, To Study Operating System and Computer System

Hun Os Writing an OS in Rust, To Study Operating System and Computer System Reference Os Written In Rust https://github.com/seonghun-dev/blog_os https

Jung Seonghun 2 Dec 15, 2022
A secure embedded operating system for microcontrollers

Tock is an embedded operating system designed for running multiple concurrent, mutually distrustful applications on Cortex-M and RISC-V based embedded

Tock Embedded OS 4.1k Jan 5, 2023
A secure embedded operating system for microcontrollers

Tock is an embedded operating system designed for running multiple concurrent, mutually distrustful applications on Cortex-M and RISC-V based embedded

Tock Embedded OS 4k Jan 2, 2023
A hobby operating system, in Rust

intermezzOS: kernel intermezzOS is a hobby operating system. This repository is for its kernel. See the website for more. License This project is dual

intermezzOS 1.3k Jan 1, 2023
The Stupid Operating System

Stupid Operating System SOS is a simple, tiny toy OS implemented in Rust. I'm writing this mostly for fun, to learn more about OS design and kernel ha

SOS 241 Dec 15, 2022
Aero is a new modern, unix based operating system. It is being developed for educational purposes.

Areo Aero is a new modern, unix based operating system written in Rust and is being developed for educational purposes. Aero follows the monolithic ke

Anhad Singh 623 Dec 24, 2022
A new operating system kernel with Linux binary compatibility written in Rust.

Kerla Kerla is a monolithic operating system kernel from scratch in Rust which aims to be compatible with the Linux ABI, that is, runs Linux binaries

Seiya Nuta 3.1k Jan 1, 2023
Operating system written in Rust for NumWorks calculator (model n0110)

RustWorks An OS (eventually) for the Numworks calculator (model n0110). Setup First install Rust by following these instuctions then: rustup target ad

null 30 Nov 10, 2022
The official kernel for Popcorn OS, and operating system designed for handheld devices.

About Popkern is the kernel for Popcorn OS, an operating system designed for handheld devices. As such, the kernel is (to be) optimised at all levels

Team Scena 3 Sep 19, 2021
Geng wanzheng ([a] more complete) asynchronous operating system

更完整系统(GWZOS) 更完整系统的目的是编写一个异步功能完整的异步操作系统。我们希望尽可能完整地实现异步内核的核心概念,提供相应的驱动、软件生态系统,为未来内核的设计探索可能的实现方案。对比不同解决方案的性能开销,得到较详细的内核验证结论。 感谢大家对项目的支持!接龙链接 设计文档请参考: 无相

Luo Jia 10 Aug 26, 2021
SteinsOS is an operating system written in Rust

SteinsOS is an operating system featuring non-preemptive kernel targeting on single-core armv8 architecture.

Sheng 84 Dec 15, 2022
Xrs is a POSIX-subset operating system kernel written in Rust.

XRS-OS ( ?? WIP) Xrs is a POSIX-subset operating system kernel written in Rust. Current project team members 0x5459 core developer (he/him) 0x5457 cor

null 7 Nov 16, 2022
A simples rust operating system that prints hello world.

rust-os-helloworld A simples rust operating system that prints hello world. Just run: cargo install bootimage and: cargo bootimage Install QEMU and: q

null 3 Nov 24, 2021
An attempt at an operating system written in Rust

Rust Operating System An attempt at a simple operating system in Rust and a semester project for the Operating Systems course at CS@UCU. Documentation

Andriy Sultanov 10 Jan 15, 2022
A small operating system, for my own learning

taos This project is the result of following Philipp Oppermann's series of tutorials in building a small operating system kernel targeting x86-64, alo

null 0 Nov 7, 2021
Cute tiny operating system for RISC-V. ฅ•ω•ฅ

MoeOS ⁄(⁄ ⁄•⁄ω⁄•⁄ ⁄)⁄ ٩(^ᴗ^)۶欢迎参观MoeOS的仓库,MoeOS是一个小巧可爱(并不)的操作系统,目前全力支持RISC-V中。 (*≧▽≦)因为还只是一个玩具操作系统,就别要求她能做太多事情啦!现在功能还不完善,会慢慢加的! 编译 呐,你想给我找个家么? 目前MoeOS

Rui Li 30 Nov 11, 2022
Rux - An x86_64 toy operating system kernel written in Rust

Rux - An x86_64 toy operating system kernel written in Rust. Rux is a port of the Hux kernel, my x86 32-bit single-CPU toy kernel written in C, following the OSTEP book structure and terminology.

Guanzhou Jose Hu 6 Feb 26, 2022
A RISC-V and unix-like operating system developed just for fun.

Orca 虎鲸 A RISC-V and unix-like operating system developed just for fun. Schedule [*] bootloader (use RustSBI-qemu) [ ] linker & stack [ ] memory alloc

Mr.Z 4 May 29, 2022
A Rust Operating System, written from the ground up

ThornOS A Rust Operating System, written from the ground up Build Dependencies Bootimage TODO: Document build process in more detail Acknowledgements

Stuart Reid 1 Mar 31, 2022