Xous
Embedded Multiprocess Microkernel
17 April 2024, Sean Cross
Outline
- About Me
- Project history
- Why a new OS?
- What can it do?
- How do I use it?
About Me
- Live in Singapore
- Enjoy understanding systems
- Low-level is best
Novena: Open laptop
- Always wanted custom laptop
- "Relatively Large" Cortex A9
- 32 GB disk, 4 GB RAM
- Linux
Chibitronics: Programming for 8-year-olds
- Paper circuit design
- "Relatively 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?
Operating System Selection
- RISC-V
- Memory Protection
- Not Linux
- Rust is a new thing?
Brief Specs
- Kernel is 17 ksloc
- Threads
- Processes
- Tier 2 Rust support
- Entire project built on stable Rust
Other Features
- Microkernel
- Interrupts in userspace
- Each page of memory is mapped once
- No C compiler required
More Specs
- Kernel is single-threaded
- Services use well-defined API calls
- All drivers provided in user space
- Each page of memory can only be lent once
Messages are Everything
- Messages form IPC
- Scalars or Pages
- Blocking or Nonblocking
Example: Sleeping
sleep(msec: usize)
- Connect to "ticktimer" server
- Send a `BlockingScalar` with desired duration
- Client will block until server replies
- Server calls `ReturnScalar()` after expiration
Example: Mutex
mutex.lock().unwrap()
- Fast path with
AtomicIsize
- Slow path by sending
LockMutex
- On unlock, contending thread will see poison and send
UnlockMutex
- Server will reply to
LockMutex
message to unblock the thread
MMUs are Amazing
- XIP flash for free!
- Swap space
- Encrypted swap? No problem!
- Realtime patching broken hardware
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