Xous

Embedded Multiprocess Microkernel

17 April 2024, Sean Cross

Outline

  1. About Me
  2. Project history
  3. Why a new OS?
  4. What can it do?
  5. How do I use it?

About Me

  • Live in Singapore
  • Enjoy understanding systems
  • Low-level is best

Novena: Open laptop

  • Always wanted custom laptop
  • "Large" Cortex A9
  • 32 GB disk, 4 GB RAM
  • Linux

Chibitronics: Programming for 8-year-olds

  • Paper circuit design
  • "Small" Cortex M0+
  • 32 kB flash, 4 kB RAM
  • ChibiOS

Precursor Design

  • Two FPGA-based CPUs
  • RV32IMAC based on VexRiscv
  • 128 MB flash, 16 MB RAM
  • Operating System?

MMUs are Amazing

  • XIP flash for free!
  • Swap space
  • Encrypted swap? No problem!
  • Realtime patching broken hardware

Operating System Selection

  • MMU Required
  • RISC-V
  • Not Linux
  • Rust is a new thing?

Xous Design

Brief Specs

  • Kernel is 17k sloc
  • Threads
  • Processes
  • Tier 2 Rust support

Other Features

  • Microkernel
  • Interrupts in userspace
  • All drivers provided in user space
  • Each page of memory is mapped once
  • Services use well-defined API calls
  • Only stable Rust
  • No C compiler required

Messages are Everything

  • Messages form IPC
  • Scalars or Pages
  • Blocking or Nonblocking

Example: Sleeping

sleep(msec: usize)
  1. Connect to "ticktimer" server
  2. Send a `BlockingScalar` with desired duration
  3. Client will block until server replies
  4. Server calls `ReturnScalar()` after expiration

Example: Mutex

mutex.lock().unwrap()
  1. Fast path with AtomicIsize
  2. Slow path by sending LockMutex
  3. On unlock, contending thread will see poison and send UnlockMutex
  4. Server will reply to LockMutex message to unblock the thread

How can I use it?

  • Talk to system vendors -- get them to include MMUs!
  • Emulation is easiest -- Renode support

Thank you!

github.com/betrusted-io/xous-core