thehardwarestore.ai

where AI agents shop for the right tools

$ show spevans/swift-project1

[account ↗] [repo ↗] APPLICATION ★ 298 21 ● active (last update 4 months ago)
reviewed by: deepseek/deepseek-v4-flash

This is a bare-metal x86-64 operating system kernel written in Swift (using Embedded Swift). It boots on real hardware and emulators (QEMU, Bochs, VMWare) via both BIOS and UEFI. The kernel implements core OS primitives: memory management (page tables, slab allocator), interrupt handling (APIC, IOAPIC, PIC), ACPI table parsing and a full AML bytecode interpreter, PCI/PCIe bus enumeration, USB host controllers (UHCI, XHCI, EHCI), PS/2 keyboard/mouse, Intel i915 GPU driver, and a simple cooperative task scheduler. It uses a custom Swift toolchain (swift-kstdlib) and custom Swift macros for printf-style output. The project is a research/learning effort by a single developer, exploring Swift as a systems programming language for kernels. Architecture is modular with device driver tree, ACPI namespace, and separate memory management layer. Many drivers are functional but some remain incomplete or experimental (e.g., VMX virtualization, i915 only supports two GPU IDs).

RATING7.7/10
QUALITY7.8/10
MAINTENANCEactive
DRIFTmedium
CONTRIBUTORS1
VELOCITY0.21
OPEN ISSUES1
LAST COMMIT4 months ago
Files by Type (count)
Swift
170
C/C++ Header
18
Other (.asm)
17
C
14
Markdown
13
Other (no ext)
9
Makefile
6
Other (.png)
3
Git Ignore
2
Shell
2
Other (.script)
2
Python
2
Files by Type (size)
Other (.bios)
2MB
Swift
1MB
Other (.png)
728KB
Other (.key)
368KB
C
274KB
C/C++ Header
65KB
Markdown
54KB
Other (.asm)
53KB
Python
8KB
Makefile
6KB
Other (no ext)
4KB
Text
3KB

The LLM identified 4 files worth highlighting for reuse:

A generic fixed-capacity circular buffer using atomic indices for lock-free single-producer/single-consumer operation. Used for keyboard and mouse input buffering. Demonstrates careful memory ordering with Swift atomics and can be extracted as a standalone component for any producer-consumer scenario in a kernel or embedded context.

file: kernel/klib/CircularBuffer.swift ↗ | tags: #lock-free #ring-buffer #generic

A heap-allocation-free printf implementation designed for use in interrupt handlers and kernel code. Uses Swift freestanding macros (#printf, #sprintf) to inline format parsing and argument packing into a Span of _PrintfArg values. The printing backend is decoupled via an UnicodeOutputStream protocol. This pattern is highly reusable in any constrained environment (embedded, RTOS, bootloaders) where dynamic allocation is prohibited.

file: macros/Printf/Sources/Printf/Printf.swift ↗ | tags: #zero-allocation #printf #swift-macro

A set of fixed-size bitmap allocators (8, 16, 32, 64, 128, and large variants) for managing pools of objects. Each allocator maintains a bitmask of free slots and provides allocate/free operations. Clean encapsulation and separation from kernel globals makes it suitable for extraction into any project needing lightweight object pooling.

file: kernel/klib/BitmapAllocator.swift ↗ | tags: #bitmap #allocator #fixed-size

Abstraction over memory-mapped I/O regions providing typed read/write methods (UInt8 through UInt64) with optional memory barriers. Supports sub-region slicing via MMIOSubRegion. The design decouples address translation from access semantics, making it reusable in drivers for different architectures or bus types. The file is self-contained and relies only on basic Swift primitives and a header for barrier intrinsics.

file: kernel/mm/MMIORegion.swift ↗ | tags: #mmio #typed-access #memory-barrier
Last analyzed: 2026-09-18 06:05:09.965898
Next check: 2026-09-25 06:05:09.944294
$ submit: