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
- "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?
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)
- 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
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