Xu 0.14.0 Released: Operating System Kernel Support, Freestanding Profile, Raw Pointers, and HAL Contracts
Xu 0.14.0 is officially released! This milestone update expands Xu's reach into low-level systems programming and modern operating system kernel development. Starting with 0.14.0, Xu is no longer restricted to hosted environments: developers can now build bare-metal bootloaders, firmware, and operating system microkernels with zero libc and runtime dependencies, while retaining ownership safety and bit-for-bit reproducible self-hosting.
1. Freestanding Execution Profile & Static Core Library #core
Developing OS kernels requires complete isolation from host operating system syscalls and hidden runtime machinery. Xu 0.14.0 introduces full freestanding support:
- Three-Level Freestanding Configuration: Configurable via source-level directive
$freestanding, manifest declaration inxu.xun(profile: freestanding), or CLI flags--profile=freestandingand--no-std. When active, all host OS syscalls, default thread/task schedulers, and libc bindings are decoupled; - Pure Static Zero-Allocation Core Library
#core:#core/arch: CPU hardware interrupt controls, system control registers (CR0/CR3/CR4), 8259A PIC and 8254 PIT programmable timers, and IDT gate descriptor structures;#core/mem: Zero-allocation physical and virtual page arithmetic and boundary validation primitives;#core/alloc: Pluggable global kernel allocator contract (GlobalAlloc), integrating with buddy allocators and kernel slab allocators;#core/sync: Interrupt-safe spinlocks (IrqSpinlockandSpinlock) with automatic RAII guard restoration of interrupt flags (EFLAGS/PSTATE);#core/task: Cross-architecture 192-byte atomic hardware context switching,TrapFrameexception state capture, and syscall dispatch entries;#core/virtio: VirtIO MMIO device drivers for virtual block storage and network adapters.
- Scaffolding & Tooling: Commands
xu init --baremetal <name>andxu new --baremetal <name>automatically scaffold kernel workspaces with custom linker scripts and Makefiles, generating minimal ELF kernel images of just 1.9 KB to 2.4 KB.
2. Strict Hardware Contracts: Raw Pointers, unsafe Blocks & Memory Layouts
To safely program memory-mapped I/O (MMIO) and hardware registers, Xu establishes an explicit isolation boundary:
- Raw Pointers (
*raw T) & Mandatoryunsafe { ... }Blocks: Arbitrary physical address dereferencing and pointer arithmetic are supported but strictly restricted inside explicitunsafe { ... }blocks:// MMIO physical VGA buffer access unsafe { $vga := cast[*raw u16](0xb8000) *vga = 0x0f41 // write white 'A' } - Volatile Access Primitives: Built-in
volatile_readandvolatile_writeintrinsics guarantee that compiler passes never reorder, hoist, or eliminate hardware MMIO register accesses; - Explicit Structure Layouts: Support for
@repr("C", align: N)and@repr("C", packed)ensures exact byte-level alignment matching CPU registers and wire protocols.
3. Compiler GVN Memory Load Forwarding & Monotonic Epoch Hardening
The compiler optimization pipeline introduces several high-impact memory forwarding improvements:
- Read-Only Direct Call Chains: GVN can reuse loaded values across direct function call chains proven to only read memory or modify their own stack frames;
- Disjoint Byte-Range Stores: Stores to disjoint byte ranges of the same base pointer (such as struct slice fields at constant indices) no longer invalidate cached loads of unrelated fields;
- CFG Join Dominance Preservation: Dominating load facts are retained at control-flow merge points whose incoming edges share memory version tags with the immediate dominator;
- Single-Pass PGO Profile Parser: PGO profile ingestion is now streamed in a single pass with line-level diagnostics, while binary layout reordering preserves DWARF function ranges and source lines.
4. Pure ASCII Installer Wizard & Automated macOS arm64 Signing
- Strict English ASCII Setup: The native setup installer and interactive CLI wizard enforce pure English ASCII across all terminal locales, avoiding encoding corruption or terminal pauses;
- macOS arm64 Toolchain Signing: The setup installer automatically performs ad-hoc code signing (
codesign --force --deep --sign -) on arm64 binaries and outputs, eliminating Apple Silicon Gatekeeper crashes.
5. Horizontal Bare-Metal & Systems Benchmarks
Empirical measurements across x86_64 and Apple Silicon hardware demonstrate lightweight efficiency:
| Benchmark Workload | Scale / Metric | Xu v0.14.0 | Rust (no_std O3) | C (Clang baremetal -O3) | Go (TinyGo / GBA) |
|---|---|---|---|---|---|
| Kernel Context-Switch Latency | 192-byte register state save/restore (Cycles) | 42 cycles (~18 ns) | 46 cycles (~20 ns) | 44 cycles (~19 ns) | N/A |
| Freestanding Binary Size | Minimal multitask + VirtIO kernel ELF (KB) | 2.1 KB | 4.2 KB (with core) | 1.8 KB | 68 KB+ |
| GVN Redundant Load Elimination | Eliminated redundant loads in tight slice loops (%) | 18.4% reduction | LLVM GVN parity | Clang parity | Pessimistic |
| Spinlock Contention & Restoral | 100,000 CLI/STI spinlock cycles (ms) | 3.2 ms | 3.4 ms | 3.1 ms | N/A |
| PGO Profile Ingestion Overhead | PGO parse and indexing duration (ms) | 64% faster | N/A | N/A | N/A |
6. Upgrading & Toolchain Distribution
Official release artifacts for Xu v0.14.0 across 30 distribution targets are available on GitHub Releases. When upgrading, please update the compiler, standard library, and SDK tools in unison.
Download Center · View All Benchmarks · GitHub Release Page · Full Release Notes