Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,11 @@ ZAR-Zig-Agent-Runtime is the Zig runtime port of OpenClaw, with parity-first del
- `src/baremetal/filesystem.zig` now routes `GET` / `LIST` / `STAT` requests through that overlay while rejecting writes under `/proc` and `/sys`
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now expose the overlay through the existing command and typed service surface without widening the opcode model
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves live `E1000` tool-service reuse for `/`, `/proc/runtime/snapshot`, `/proc/runtime/sessions/<id>`, `/sys/storage/state`, and virtual `STAT` readback on the freestanding PVH path
- fourth delivered adoption slice is a ZAR-native read-only device overlay inspired by ZigOS `devfs`:
- `src/baremetal/virtual_fs.zig` now exposes synthetic `/dev` entries for storage, display, network, and a bounded `/dev/null` sink on top of existing ZAR state
- `src/baremetal/filesystem.zig` now routes `GET` / `LIST` / `STAT` requests through that `/dev` overlay while rejecting writes under `/dev`
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now expose `/dev` through the same command and typed service surface
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves live `E1000` tool-service reuse for `/dev`, `/dev/storage/state`, and the expanded root overlay on the freestanding PVH path
- keyboard/mouse is now strict-closed in [`docs/zig-port/FS5_5_HARDWARE_DRIVERS_SYSTEMS.md`](docs/zig-port/FS5_5_HARDWARE_DRIVERS_SYSTEMS.md)
- `src/baremetal/ps2_input.zig` now contains a real x86 port-I/O backed PS/2 controller path
- `scripts/baremetal-qemu-ps2-input-probe-check.ps1` proves IRQ-driven keyboard/mouse state updates against the freestanding PVH artifact
Expand Down
13 changes: 11 additions & 2 deletions docs/zig-port/FS5_5_HARDWARE_DRIVERS_SYSTEMS.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ This track exists to remove guesswork. It defines the real bare-metal subsystems

## ZigOS Reference Track

Status: `Slices 1-3 delivered`
Status: `Slices 1-4 delivered`

This track uses `Cameron-Lyons/zigos` as a reference architecture and source candidate where it improves ZAR.

Expand Down Expand Up @@ -65,7 +65,16 @@ Delivered third adoption slice:
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now expose the overlay through the existing builtin and typed `GET` / `LIST` / `STAT` surface instead of inventing a second management protocol
- host regressions now prove `/proc/runtime/snapshot`, `/proc/runtime/sessions/<id>`, `/sys/storage/state`, root overlay listing, and read-only path rejection
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves the same overlay live over the clean-room `E1000` tool-service path, including `/`, `/proc/runtime/snapshot`, `/sys/storage/state`, and virtual `STAT` readback
- full ZigOS-style VFS, `tmpfs`, `devfs`, `ext2`, and `fat32` remain future redesign work; this slice closes the first bounded introspection layer only

Delivered fourth adoption slice:

- ZAR-native read-only device overlay inspired by ZigOS `devfs`
- `src/baremetal/virtual_fs.zig` now exposes synthetic `/dev` entries for storage, display, network, and a bounded `/dev/null` sink on top of existing ZAR state
- `src/baremetal/filesystem.zig` now routes `readFileAlloc`, `listDirectoryAlloc`, and `statSummary` through that `/dev` overlay and rejects writes under `/dev`
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now expose `/dev` through the same builtin and typed `GET` / `LIST` / `STAT` surface
- host regressions now prove `/dev`, `/dev/storage/state`, `/dev/display/state`, root overlay listing, and read-only path rejection
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves `/`, `/dev`, `/dev/storage/state`, and virtual `STAT` readback live over the `E1000` tool-service path
- full ZigOS-style VFS, `tmpfs`, mount semantics, `ext2`, and `fat32` remain future redesign work; this slice closes the bounded `/dev` overlay only

`FS5.5` is not complete until each subsystem has:

Expand Down
2 changes: 1 addition & 1 deletion docs/zig-port/PHASE_CHECKLIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Registry status:
- `scripts/package-registry-status.ps1` now checks public npmjs/PyPI visibility correctly even when called with only `-ReleaseTag`, so local release diagnostics no longer silently skip the unresolved registry state.
- release evidence now also includes `release-status.json` + `release-status.md`, which snapshot package visibility plus the latest `zig-ci` / `docs-pages` / `release-preview` / `npm-release` / `python-release` workflow state for the target tag.
- `FS5.6` repo-wide license refresh is now strict-closed locally: root/package license files, release evidence, package metadata, and Linux-style SPDX headers now use `GPL-2.0-only` to match the Linux-derived RTL8139 slice.
- ZigOS reference-only integration planning is now tracked in:
- ZigOS integration planning is now tracked in:
- `docs/zig-port/ZAR_VS_ZIGOS_INTEGRATION_PLAN.md`
- `docs/zig-port/ZAR_VS_ZIGOS_E1000_SLICE_PLAN.md`
Expand All @@ -20,6 +19,7 @@ Registry status:
- bounded framed tool-service reuse is now closed over `E1000` through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`, and bounded `HTTP` / `HTTPS` transport reuse remains closed through `scripts/baremetal-qemu-e1000-http-post-probe-check.ps1` and `scripts/baremetal-qemu-e1000-https-post-probe-check.ps1`.
- second delivered adoption slice is the hosted benchmark lane through `src/benchmark_suite.zig`, `src/benchmark_main.zig`, and `scripts/benchmark-smoke-check.ps1`, with the current catalog covering DNS, DHCP, TCP, runtime-state queue churn, and tool-service codec parsing.
- third delivered adoption slice is a ZAR-native read-only introspection overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, with `/proc` + `/sys` exported over existing runtime/storage/display/network state, host regressions for `GET` / `LIST` / `STAT` plus write rejection, and live `E1000` tool-service proof through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`.
- fourth delivered adoption slice is a ZAR-native read-only device overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, with `/dev` exported over existing storage/display/network device state, host regressions for `GET` / `LIST` / `STAT` plus write rejection, and live `E1000` tool-service proof through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`.
- `FS5.5` framebuffer/console strict closure is now reached locally: `src/baremetal/framebuffer_console.zig` programs a real Bochs/QEMU BGA linear-framebuffer path with bounded mode support for `640x400`, `800x600`, `1024x768`, `1280x720`, and `1280x1024`, `src/baremetal/pci.zig` discovers the selected PCI display adapter as structured metadata, exposes the framebuffer BAR, and enables decode on that function, `src/baremetal/edid.zig`, `src/baremetal/display_output.zig`, and `src/baremetal/virtio_gpu.zig` now add the first real EDID-backed controller path over `virtio-gpu-pci` including exported capability flags for digital input, preferred timing, CEA, DisplayID, HDMI-vendor-data, and basic-audio metadata when present plus EDID-derived connector inference, bounded per-output entry export, and bounded resource-create/attach/set-scanout/flush behavior, `src/pal/framebuffer.zig` exposes the surface plus supported-mode enumeration and display-output state through the PAL, host regressions in `src/baremetal/framebuffer_console.zig`, `src/baremetal/virtio_gpu.zig`, `src/baremetal_main.zig`, and `src/baremetal/display_output.zig` prove framebuffer state, display-output state, adapter metadata, supported-mode enumeration, glyph pixel updates, bounded mode switching, present counters, non-zero scanout pixels, connector inference from EDID capability flags, and the output-entry table, and the live QEMU+GDB proofs `scripts/baremetal-qemu-framebuffer-console-probe-check.ps1` and `scripts/baremetal-qemu-virtio-gpu-display-probe-check.ps1` now read back real MMIO banner pixels plus BGA adapter metadata and real `virtio-gpu-pci` EDID/controller capability state with non-zero scanout pixels and validated output-entry metadata over the freestanding PVH artifact; real HDMI/DisplayPort connector-specific scanout paths remain future depth and are not claimed here.
- Latest FS5.5 display connector activation slice: `src/baremetal/display_output.zig` now retargets the exported active output from bounded per-output entries, `src/baremetal/tool_exec.zig` now exposes `display-activate <connector>` and uses connector-targeted activation in launch profiles, `src/baremetal/tool_service.zig` now exposes typed `DISPLAYACTIVATE`, host/module validation proves successful activation of the connected connector plus explicit mismatched-connector rejection, and `scripts/baremetal-qemu-virtio-gpu-display-probe-check.ps1` now proves the same success/rejection behavior on the live `virtio-gpu-pci` controller path.
- Latest FS5.5 display output mode slice: `src/baremetal/display_output.zig` and `src/baremetal/virtio_gpu.zig` now support explicit per-output mode retargeting on the real `virtio-gpu-pci` path, `src/pal/framebuffer.zig` and `src/baremetal_main.zig` expose that same bounded control through the PAL and `oc_display_output_set`, `src/baremetal/tool_exec.zig` now exposes `display-output-set <index> <width> <height>`, `src/baremetal/tool_service.zig` now exposes typed `DISPLAYOUTPUTSET`, host/module validation proves the connected output can be driven to `1024x768` while oversized requests are rejected without corrupting the exported state, and `scripts/baremetal-qemu-virtio-gpu-display-probe-check.ps1` now proves the same explicit output-index mode change on the live controller path.
Expand Down
1 change: 1 addition & 0 deletions docs/zig-port/PORT_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ Full-stack replacement execution reference:
- bounded framed tool-service reuse is now closed over `E1000` through `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`, and bounded `HTTP` / `HTTPS` transport reuse remains closed through host regressions plus `scripts/baremetal-qemu-e1000-http-post-probe-check.ps1` and `scripts/baremetal-qemu-e1000-https-post-probe-check.ps1`
- second delivered adoption slice is the hosted benchmark lane through `src/benchmark_suite.zig`, `src/benchmark_main.zig`, and `scripts/benchmark-smoke-check.ps1`
- third delivered adoption slice is a ZAR-native read-only introspection overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, exposing `/proc` + `/sys` over the existing runtime/storage/display/network state, reusing the existing builtin and typed `GET` / `LIST` / `STAT` tool-service surface, and proving the same overlay live over `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`
- fourth delivered adoption slice is a ZAR-native read-only device overlay through `src/baremetal/virtual_fs.zig` and `src/baremetal/filesystem.zig`, exposing `/dev` over the existing storage/display/network device state, reusing the existing builtin and typed `GET` / `LIST` / `STAT` tool-service surface, and proving the same overlay live over `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1`
- `FS5.5` hardware-driver pivot update:
- framebuffer/console strict closure is now reached locally.
- real linear-framebuffer path shipped in `src/baremetal/framebuffer_console.zig`:
Expand Down
25 changes: 14 additions & 11 deletions docs/zig-port/ZAR_VS_ZIGOS_INTEGRATION_PLAN.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

## Status

This document tracks the strict, reference-only integration plan for ideas and feature targets observed in `Cameron-Lyons/zigos`.
This document tracks the strict integration plan for ideas, adapted code, and feature targets observed in `Cameron-Lyons/zigos`.

Current posture:

- ZigOS upstream is now explicitly `MIT` licensed.
- ZAR can legally study, adapt, or import ZigOS code when that is the right engineering choice.
- Current delivered slices remain ZAR-owned implementations with ZAR-native tests, probes, and release gates.
- Delivered ZigOS-inspired slices: `3`
- Delivered ZigOS-inspired slices: `4`

## Source Baseline

Expand Down Expand Up @@ -42,11 +42,11 @@ That removes the previous legal blocker, but it does not remove ZAR's engineerin

Any ZAR slice influenced by ZigOS must satisfy all of the following:

1. ZAR-owned implementation only
2. ZAR-owned tests only
3. ZAR-owned live probe coverage only
4. no imported upstream text beyond short factual references
5. explicit tracking note that the slice is `reference-inspired`, not imported
1. implementation is either ZAR-owned or explicitly tracked as adapted/imported ZigOS code
2. tests remain ZAR-owned
3. live probe coverage remains ZAR-owned
4. provenance stays explicit in docs and issue tracking
5. each slice is labeled as `reference-inspired`, `adapted`, or `imported`

## Capability Inventory

Expand All @@ -63,7 +63,7 @@ The table below is the current strict classification for every realistic ZigOS a
| `VGA path` | `src/kernel/drivers/vga.zig` | Low | Already covered conceptually | Reference only |
| `VFS core` | `src/kernel/fs/vfs.zig` | High | Major redesign | ZAR-native VFS design doc first |
| `tmpfs` | `src/kernel/fs/tmpfs.zig` | Medium-high | Adapt later | Rebuild concept over ZAR runtime/package/workspace state |
| `devfs` | `src/kernel/fs/devfs.zig` | Medium-high | Adapt later | Rebuild concept over ZAR bare-metal devices |
| `devfs` | `src/kernel/fs/devfs.zig` | Medium-high | Adapt now | First bounded read-only `/dev` overlay delivered; broader device/VFS model remains later |
| `procfs` | `src/kernel/fs/procfs.zig` | Medium-high | Adapt now | First bounded read-only `/proc` overlay delivered; broader VFS remains later |
| `sysfs` | `src/kernel/fs/sysfs.zig` | Medium-high | Adapt now | First bounded read-only `/sys` overlay delivered; broader VFS remains later |
| `ext2` | `src/kernel/fs/ext2.zig` | Medium | Major redesign | Only after ZAR VFS exists |
Expand All @@ -85,7 +85,7 @@ The table below is the current strict classification for every realistic ZigOS a

## Integration Order

The order below is strict. It favors bounded clean-room wins before any redesign-heavy GP-OS work.
The order below is strict. It favors bounded, low-risk wins before any redesign-heavy GP-OS work.

### Z0. Provenance Discipline

Expand Down Expand Up @@ -165,12 +165,15 @@ Current delivered scope:
- `src/baremetal/filesystem.zig` now routes `readFileAlloc`, `listDirectoryAlloc`, and `statSummary` through that overlay and rejects writes under `/proc` / `/sys`
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` reuse the existing builtin and typed `GET` / `LIST` / `STAT` surface for the overlay
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves the overlay live on the clean-room `E1000` tool-service path
- `src/baremetal/virtual_fs.zig` now also exposes a bounded read-only `/dev` overlay over existing ZAR storage, display, and network device state
- `src/baremetal/filesystem.zig` now routes `readFileAlloc`, `listDirectoryAlloc`, and `statSummary` through that `/dev` overlay and rejects writes under `/dev`
- `src/baremetal/tool_exec.zig` and `src/baremetal/tool_service.zig` now reuse the same builtin and typed `GET` / `LIST` / `STAT` surface for `/dev`
- `scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1` now proves `/`, `/dev`, and `/dev/storage/state` live on the `E1000` tool-service path

Still intentionally out of scope for this slice:

- full VFS mount model
- `tmpfs`
- `devfs`
- external on-disk filesystems such as `ext2` / `fat32`
- userspace-facing path semantics beyond the current read-only introspection tree

Expand Down Expand Up @@ -251,7 +254,7 @@ These are explicitly not part of the first ZigOS reference track:

Any ZigOS-inspired ZAR slice must satisfy all of the following:

1. implementation is ZAR-owned and clean-room
1. implementation has explicit provenance and review
2. host regression coverage exists
3. live bare-metal proof exists where hardware semantics matter
4. `zig build test --summary all` is green
Expand Down
68 changes: 63 additions & 5 deletions scripts/baremetal-qemu-e1000-tool-service-probe-check.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -124,17 +124,75 @@ function Resolve-CompilerRtArchive {
return $null
}

$candidate = Get-ChildItem -Path $objRoot -Recurse -Filter 'libcompiler_rt.a' -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending |
Select-Object -First 1
$candidates = Get-ChildItem -Path $objRoot -Recurse -Filter 'libcompiler_rt.a' -ErrorAction SilentlyContinue |
Sort-Object LastWriteTime -Descending

if ($null -ne $candidate) {
return $candidate.FullName
foreach ($candidate in $candidates) {
if (Test-CompilerRtArchiveElf -ArchivePath $candidate.FullName) {
return $candidate.FullName
}
}

return $null
}

function Resolve-TemporaryRoot {
$candidates = @(
$env:TEMP,
$env:TMPDIR,
$env:TMP,
[System.IO.Path]::GetTempPath()
)

foreach ($candidate in $candidates) {
if (-not [string]::IsNullOrWhiteSpace($candidate)) {
return $candidate
}
}

throw 'Temporary directory is not available.'
}

function Test-CompilerRtArchiveElf {
param(
[string] $ArchivePath
)

if (-not (Test-Path $ArchivePath)) {
return $false
}

$memberName = (& $zig ar t $ArchivePath 2>$null | Select-Object -First 1)
if ([string]::IsNullOrWhiteSpace($memberName)) {
return $false
}

$scratchRoot = Join-Path (Resolve-TemporaryRoot) 'zar-zig-probe-compiler-rt'
$scratchDir = Join-Path $scratchRoot ([System.Guid]::NewGuid().ToString('N'))
New-Item -ItemType Directory -Force -Path $scratchDir | Out-Null
try {
Push-Location $scratchDir
try {
& $zig ar x $ArchivePath $memberName 2>$null | Out-Null
} finally {
Pop-Location
}
$memberPath = Join-Path $scratchDir $memberName
if (-not (Test-Path $memberPath)) {
return $false
}
$bytes = [System.IO.File]::ReadAllBytes($memberPath)
if ($bytes.Length -lt 4) {
return $false
}
return ($bytes[0] -eq 0x7F -and $bytes[1] -eq 0x45 -and $bytes[2] -eq 0x4C -and $bytes[3] -eq 0x46)
} finally {
if (Test-Path $scratchDir) {
Remove-Item -Force -Recurse $scratchDir
}
}
}

function New-RawDiskImage {
param(
[string] $Path,
Expand Down
Loading
Loading