SawitCore
SawitCore OS is a specialized Unikernel Database Operating System built with Rust, designed to run directly on bare metal (x86_64) without a traditional OS like Linux.
Install / Use
/learn @WowoEngine/SawitCoreREADME
SawitCore [OS]
SawitCore OS is a specialized Unikernel Database Operating System built with Rust, designed to run directly on bare metal (x86_64) without a traditional OS like Linux. It prioritizes performance for database workloads through direct hardware access.
The goal is to port the SawitDB engine (originally Go/Node.js) to run natively as the OS kernel.
<div align="center"> </div>Current Features
- Kernel Core: Minimal x86_64 kernel with custom target specification.
- VGA Text Mode: Driver for printing text to the screen (
println!macro). - Interrupt Handling:
- IDT (Interrupt Descriptor Table)
- PIC (Programmable Interrupt Controller)
- Keyboard Input (via PS/2 Controller)
- Memory Management:
- Paging (Recursive Page Tables)
- Heap Allocation (
Linked List Allocator) - Dynamic types enabled (
Box,Vec,String, etc.)
- Async & Multitasking:
- Cooperative Multitasking (Async/Await)
- Simple Task Executor
- Lock-free Scancode Queue (
crossbeam-queue)
- User Interface:
- Interactive Shell (
Sawit>) - Management Menu (
managecommand)
- Interactive Shell (
Project Structure
The project is organized as a Rust workspace:
src/: Kernel source codemain.rs: Kernel entry point and initializationlib.rs: Central module exports and PIC initializationdrivers/: Hardware driversvga_buffer.rs: VGA text mode driverserial.rs: COM1 serial port drivernet.rs: VirtIO network drivervirtio_transport.rs: Legacy PCI transport for VirtIOvirtio_hal.rs: DMA memory management (HAL trait)block.rs: Block I/O abstraction
sawitdb/: Database enginemod.rs: Database module exportsbtree.rs: BTree index implementationpager.rs: Page management and I/O
task/: Async executor and taskssimple_executor.rs: Cooperative task executorkeyboard.rs: Keyboard input handlershell.rs: Interactive shell tasknet.rs: Network polling and server tasks
memory.rs&allocator.rs: Memory managementinterrupts.rs: IDT and interrupt handlers
tools/: Helper scriptsrun.ps1: Build and run with user-mode networkingrun_tap.ps1: Build and run with TAP networking (requires admin)test_network.ps1: Auto-detect network mode and launch
docs/: DocumentationTAP_NETWORK_SETUP.md: TAP adapter setup guideNETWORK_TESTING.md: Network testing procedures
Roadmap / TODO
Features
Core OS
- [x] Custom bootloader with
bootimage - [x] VGA text mode driver
- [x] Serial port driver (COM1)
- [x] Interrupt handling (IDT)
- [x] Memory management (paging, heap allocation)
- [x] Keyboard input handling
- [x] Shell interface (VGA console)
SawitDB Integration
- [x] Core types (
Valueenum for Int/Float/String) - [x] BTree index implementation (insert, search)
- [x] Pager with block I/O abstraction
- [x] RamDisk storage backend (in-memory)
- [x] Shell commands:
db_init,put,get(via management menu) - [x] Global database state management
- [ ] Persistent storage (requires disk driver)
Networking (In Progress)
- [x] VirtIO network driver (Legacy PCI transport)
- [x] smoltcp TCP/IP stack integration
- [x] TCP server on port 8023
- [x] Network interface configuration (10.0.2.15/24)
- [x] Feature negotiation (VIRTIO_F_MRG_RXBUF masking)
- [x] DMA memory management via VirtioHal
- [x] Polling-based network task
- [⚠️] RX packet reception (blocked by QEMU/Windows TAP limitation)
- [ ] TCP echo/shell functionality (pending RX fix)
Note: Network stack is 85% complete. Code is production-ready but RX reception is blocked by QEMU user-mode networking limitations on Windows. See docs/TAP_NETWORK_SETUP.md for TAP adapter setup, or use WSL2/Linux for full functionality.
Building and Running
Prerequisites
- Rust Nightly:
rustup toolchain install nightly - Bootimage:
cargo install bootimage - QEMU: Ensure
qemu-system-x86_64is in your PATH.
Run (QEMU)
Use the provided PowerShell script:
./tools/run.ps1
Or manually:
cargo build
cargo bootimage
qemu-system-x86_64 -drive format=raw,file=target/x86_64-sawitcore/debug/bootimage-sawitcore-os.bin
License & Contributing
- License: This project is licensed under the MIT License.
- Contributing: Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests to us.
