universalisos/pikeos_5_parity_gap_analysis.md

99 lines
6 KiB
Markdown

# PikeOS 5.0 → UniversalisOS Parity Gap Analysis
> Generated from deep analysis of `pikeos-mirror/` vs `universalisos/kernel/`
> Date: 2026-07-11
## Executive Summary
The UniversalisOS kernel has achieved **~40% feature parity** with the PikeOS 5.0 SDK. Core microkernel primitives (scheduler, IPC, memory, partitions) are implemented. The largest gaps are in the native personality runtime (`p4ext`), hardware virtualization (`p4hwvirt`), network stack (`ANIS`), and the complete driver framework (`DDK`/`HL*`).
## Parity Matrix
### Implemented (Full or Partial Parity)
| PikeOS Component | Prefix | UniversalisOS Status | Notes |
|-----------------|--------|---------------------|-------|
| Kernel core | `p4_` | ✅ `uos_` | Task, partition, VM, memory, IRQ, time, event, system APIs |
| Error codes | `UOS_ERR_` | ✅ `UOS_ERR_` | 145+ codes in `uos_errorcodes.h` |
| Scheduler | `p4_sched` | ✅ `sched::Scheduler` | Priority queues, EDF/RM, time partitions |
| IPC | `p4ipc_` | ✅ `ipc::MessageQueue` | Queuing ports, events, semaphores, mutexes, shared memory |
| Memory | `p4mm_` | ✅ `mm::HeapManager` | Guard bands, corruption detection, bounds checking |
| Partition manager | `p4_part` | ✅ `partition_*` | Create, start, stop, suspend, resume, destroy, ARINC 653 |
| Health monitoring | `p4hm_` | ✅ `uos_hm_*` | ARINC-653 HM table matching, fault actions |
| Resource partitioning | `p4respart_` | ✅ `respart_*` | Static bump allocator |
| Spinlocks | `p4_spin_*` | ✅ `sync::Spinlock` | Test-and-set, reader-writer, deadlock detection |
| Safety | — | ✅ `safety::*` | Bounds checker, violation logging, audit trail |
| POSIX ABI | — | ✅ `uos_posix_*` | POSIX personality dispatch |
| ADT library | `uos_adt_` | ✅ Ported in `core/adt/` | avl, base, crc32, kdev, lheap, list, stand |
| Hypervisor paravirt | — | ✅ `uos_hv_*` | AArch64 HVC, RISC-V ecall hypercalls |
| System calls | — | ✅ `UOS_SC_*` | 90+ syscall numbers |
### NOT Implemented (Major Gaps)
| PikeOS Component | Prefix | UniversalisOS Status | Priority | Effort |
|-----------------|--------|---------------------|----------|--------|
| **Native personality runtime** | `uos_ext_` | ❌ Missing | HIGH | Large — threads, stacks, malloc, vmem, TLS, diagnostics |
| **HW virtualization** | `uos_hwvirt_` | ❌ Missing | HIGH | Large — guest init, run, exception handling, registers |
| **VMM protocol** | `UOS_VMM_` | ❌ Missing | HIGH | Medium — HVC message protocol, device virtualization |
| **Linux guest bridge** | `UOS_BUS_` | ❌ Missing | HIGH | Large — block, char, net, tty device virtualization |
| **ANIS network stack** | `UOS_ANIS_` | ❌ Missing | MEDIUM | Large — full TCP/IP stack |
| **APEX services** | `uos_apex_`/`UOS_APEX_` | ❌ Missing | MEDIUM | Large — blackboards, buffers, logbooks, file system |
| **DDK driver framework** | `UOS_DDK_` | ❌ Missing | MEDIUM | Very Large — blk, can, char, clk, dio, net, pci, ser, sys, wdt |
| **High-level drivers** | `HL*_` | ❌ Missing | MEDIUM | Large — HLNET, HLSER, HLBLK, HLDIO, HLCAN, HLCLK |
| **Volume provider** | `UOS_VP_` | ❌ Missing | MEDIUM | Medium — CFS, FAT filesystem support |
| **Tracing** | `UOS_TRACE_` | ❌ Missing | LOW | Medium — Spider instrumentation system |
| **Instrumentation** | `UOS_IMON_`/`UOS_INSTRUMON_` | ❌ Missing | LOW | Small — IMON monitor |
| **Device driver API** | `UOS_DDAPI_` | ❌ Missing | LOW | Small — DDAPI abstraction |
| **KDEV framework** | `uos_kdev_` | ⚠️ Partial | HIGH | Large — gate/provider model, event queues, I/O |
| **Build system** | `.cmp`/`makeinc` | ❌ Missing | HIGH | Very Large — 1,316 component descriptors |
### Partially Implemented
| PikeOS Component | Prefix | UniversalisOS Status | Gap |
|-----------------|--------|---------------------|-----|
| KDEV config format | `uos_kdev_` | ⚠️ ADT ported, framework missing | Gate/provider model, event queues |
| Memory management | `p4mm_` | ⚠️ Heap manager exists | Missing: region create/destroy, DMA, shared memory, fault detection |
| System environment | `p4_se_` | ⚠️ VM create/start/stop exists | Missing: SE port operations, ROM image management |
## Critical Path Parity Blockers
1. **KDEV gate/provider model** — Required for all driver integration. Without it, no DDK drivers can work.
2. **p4ext native personality** — Required for running PikeOS-native applications. Without it, only bare-metal code runs.
3. **p4hwvirt hypervisor** — Required for guest OS virtualization. Without it, no Linux/RTOS guests.
4. **Build system (.cmp files)** — Required for automated component integration. Without it, manual configuration only.
## Recommended Implementation Order
| Phase | Component | Est. Effort | Dependencies |
|-------|-----------|-------------|--------------|
| 1 | KDEV gate/provider | 2-3 weeks | None |
| 2 | p4hwvirt hypervisor | 4-6 weeks | KDEV |
| 3 | p4ext native personality | 3-4 weeks | KDEV, p4hwvirt |
| 4 | P4BUS Linux bridge | 3-4 weeks | p4hwvirt |
| 5 | VMM protocol | 2-3 weeks | p4hwvirt |
| 6 | ANIS network stack | 4-6 weeks | P4BUS |
| 7 | DDK driver framework | 6-8 weeks | KDEV |
| 8 | APEX services | 4-6 weeks | None (independent) |
| 9 | Volume provider | 2-3 weeks | DDK |
| 10 | Spider tracing | 2-3 weeks | None |
| 11 | Build system (.cmp) | 4-6 weeks | All above |
| 12 | Documentation | 3-4 weeks | All above |
**Total estimated effort**: 38-55 weeks (10-14 months) for full parity.
## Files Analysis
### pikeos-mirror/ Statistics
| Directory | Files | Size | Parity Status |
|-----------|-------|------|---------------|
| `sources/` | ~500 | ~50 MB | ⚠️ Partial (p4ext, kernel headers) |
| `target/` | ~8,000 | ~200 MB | ❌ Mostly missing (.cmp configs) |
| `share/` | ~2,000 | ~300 MB | ⚠️ Partial (boot, hwvirt-linux) |
| `tfw/` | ~100 | ~1 MB | ❌ Not ported |
| `demo/` | ~500 | ~5 MB | ❌ Not ported |
| `build/adt/` | ~30 | ~500 KB | ✅ Ported |
| `config/` | ~25 | ~100 KB | ✅ Ported |
| `rpm/` | ~160 | ~9 MB | ✅ Rebranded |
| `scov/` | ~6,000 | ~322 MB | ✅ Rebranded (third-party) |
| `cdk/` | ~1,400 | ~145 MB | ✅ Rebranded (pre-built) |