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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## M6B Virtio Block Transport candidate — 2026-07-26

- Architecture-independent 512-byte sector block-device contract.
- Validated I/O, 32-bit, and 64-bit PCI BAR decoding.
- Modern virtio PCI common, notify, device, and configuration-window parsing.
- `VIRTIO_F_VERSION_1` negotiation and fail-closed device initialization.
- Allocator-owned, direct-mapped split virtqueue with one outstanding request.
- Polling read, write, and device-ID requests with status/reset/timeout errors.
- Dedicated disk identity verification and known-sector read evidence.
- Disposable-sector write/readback followed by restoration of original bytes.
- Sector-boundary rejection and `block` shell diagnostics.
- Capability registry version 5 and full M5/FH1/FH2/FH3/M6A regressions.

M6B does not mount a filesystem or expose general-purpose persistent writes.
Buffer caching and VFS contracts remain M6C; read-only FAT32 remains M6D.

## M6A PCI and Storage Discovery candidate — 2026-07-26

- Architecture-independent PCI identity and storage classification.
Expand Down
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 9 additions & 8 deletions PROJECT.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
- Architecture: x86-64
- Firmware: UEFI 2.x
- Primary language: Rust 2024
- Accepted checkpoint: Foundation Hardening Phase 3
- Immutable release: `v0.0.8-fh3`
- Current development checkpoint: M6A PCI and storage discovery
- Accepted checkpoint: M6A PCI and Storage Discovery
- Immutable release: `v0.0.9-m6a`
- Current development checkpoint: M6B virtio block transport
- Deployment policy: QEMU only until physical-install safety gates pass

## Mission
Expand All @@ -21,11 +21,12 @@ Development is grouped into major milestone batches. Small formatting or CI corr

## Current objective

Enumerate the QEMU PCI topology through hardware configuration transactions,
retain a bounded device inventory, and match a dedicated virtio block target
without issuing disk I/O.
Activate the dedicated QEMU virtio block target behind an
architecture-independent sector contract. Validate modern PCI capabilities,
feature negotiation, DMA queue ownership, a known-sector read, and a confined
write/readback/restore transaction.

## Next major objective

Add a polling virtio-blk transport and architecture-independent block-device
API after M6A passes QEMU.
Add a fixed-capacity block cache and VFS contracts without enabling persistent
filesystem writes.
30 changes: 21 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ SanjuOS is an independent, Rust-first desktop operating-system project. It is
not a Linux distribution. Development proceeds through emulator-verified kernel
milestones before any physical-disk work.

## Current checkpoint: M6A PCI and Storage Discovery
## Current checkpoint: M6B Virtio Block Transport

The accepted baseline entering this phase was the Foundation Hardening Phase 2
candidate. M0 through FH2 proved UEFI ownership transfer, protected kernel
execution, interrupts, Ring 3 entry, `SYSCALL`/`SYSRET`, ELF64 loading,
recoverable user faults, physical ownership, and a fresh SanjuOS page-table
root.

The accepted `v0.0.8-fh3` release turns the process runtime into an active
The accepted `v0.0.8-fh3` release turned the process runtime into an active
hardware boundary:

- each M5 process owns a deep-cloned four-level page-table root;
Expand All @@ -31,19 +31,30 @@ hardware boundary:
The authoritative maturity status is generated at
[`docs/CAPABILITY_MATRIX.md`](docs/CAPABILITY_MATRIX.md).

M6A now begins the storage stack without issuing disk I/O:
The accepted `v0.0.9-m6a` release begins the storage stack without issuing
disk I/O:

- x86 PCI configuration mechanism #1 is probed directly;
- bus/device/function discovery handles multifunction devices and bridges;
- an allocation-free kernel inventory classifies storage controllers;
- QEMU attaches a disposable second disk through `virtio-blk-pci`;
- boot and shell evidence must identify that exact block target;
- sector I/O remains the separate M6B acceptance gate.
- sector I/O remains a separate acceptance gate.

M6B implements that gate on the dedicated QEMU test disk:

- an architecture-independent, sector-based block-device contract;
- validated PCI BARs and modern virtio PCI capabilities;
- `VIRTIO_F_VERSION_1` negotiation with unsupported read-only media rejected;
- one allocator-owned, direct-mapped DMA page containing a split virtqueue;
- bounded polling with reset, status, and timeout failures returned safely;
- a seeded read test plus a disposable write/readback/restore transaction;
- a `block` shell diagnostic and exact QEMU acceptance evidence.

## Shell commands

```text
help version userspace uptime memory irq tasks ls cat write echo clear
help version userspace uptime memory irq tasks pci block ls cat write echo clear
```

## Build and verify
Expand Down Expand Up @@ -73,11 +84,12 @@ docs/ Requirements, architecture, ADRs, testing, security, process

## Current boundary

M6A and FH3 remain single-core and PIT-driven. The combined EFI-stub kernel still
M6B and FH3 remain single-core and PIT-driven. Block completion is synchronous
and polling, one request is outstanding at a time, and only the explicitly
identified disposable QEMU disk is used. The combined EFI-stub kernel still
retains a bounded identity mapping while a separate high-half kernel image is
designed. Per-process floating-point/SIMD state, SMP, local APIC timers, PCID,
copy-on-write, and demand paging remain future hardening work. PCI discovery,
the virtio block transport, a persistent VFS, and graphics are later gates.
designed. A block cache, VFS, read-only FAT32, persistent writes, physical-disk
installation, graphics, SMP, and local APIC timers remain later gates.

## Safety

Expand Down
55 changes: 29 additions & 26 deletions SOURCE_MANIFEST.sha256
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,20 @@ ae0cb6c3b2dcaed5941d193848a2d05028f12f0692e95aacf2808ed7b037dd8f .gitattributes
9f35a88b86d7601a4b40fe13e7987baac18a1310911aec01111ee123f8bbc3a4 .github/workflows/ci.yml
4337eb9c42b5bfdf2840306b3944a65e475e21af781307f998ef299b56f685d7 .gitignore
17fe0e368f6e7327b413a3113c56cce5f169a1ccb54f0b65375e4abcacc35145 assets/branding/sanjuos-logo.png
9fa60d55cd2b806393077b7abaaa62bb414a56fb216e1fc6d14917110dc13bb8 boot/uefi/Cargo.toml
41989b585af5a688ea5309a7246851be5a458c5707fa393c6e341e65743c9e8b boot/uefi/Cargo.toml
d80a890c3bfcb13a3a9fc850b6e9b9a2eea333c83b1e78c5db60abd0272bc9b8 boot/uefi/src/arch/mod.rs
9eac8368fa9313ef48f096ba913f30666a4227bee28554d2b7e7bcc426bc3ed1 boot/uefi/src/arch/x86_64/mod.rs
dd4aea80aed8b6589dea0e9a0a98a206ff0822a4a729a910a6f2edc94b9a102b boot/uefi/src/arch/x86_64/mod.rs
3899462a2005889f9e86c3ef775364441b46f0b7da079cad52e792c02fb6b997 boot/uefi/src/arch/x86_64/paging.rs
59da4fe3599bcad80f53bceea8a6d1780edd03997c668e998d8ec493e95c1279 boot/uefi/src/arch/x86_64/pci.rs
dd017528cd4bd9206416bc0df717263aca92719b80ffd83009902577b519ce32 boot/uefi/src/arch/x86_64/pci.rs
74116134615fd003f8592bec4557a326920ffa0a70f1b2afde755c44844c4b9f boot/uefi/src/arch/x86_64/qemu.rs
7d11876ab13082c796a5a2af100ece7b713251c408e3c67b313cc51ed3a3d410 boot/uefi/src/arch/x86_64/serial.rs
da344eb5fbd6d0e5a7c01e70b081fe953653213791b3dea8533ace915f214d89 boot/uefi/src/main.rs
38736de28b1960cc3d033d665c2bc9ee871ed73229eaa1744545ab9acf9bea97 capabilities/capabilities.toml
a48eb659ae8d4f167f01a60a8fcf2ee60c287a867ae5a340f3e302d93bbdc21b capabilities/smoke-expectations.txt
14c0e3a2df7e38bdfb8f2a24c14706707af9ed4c9ab7fa494d1672f0b85a0031 Cargo.lock
7143759544dc7000e33aa1f2e7d554997596256ac9e1d3f4a4b71c7101082d3b boot/uefi/src/arch/x86_64/virtio_block.rs
aaeeb7a569404479f0d98055809b63639bf0646177d9f34d0755dd91fff73416 boot/uefi/src/main.rs
b7542374ecc32918dbe6554b78ade101d5f8c8ea99340dc702d01f3fccf01659 capabilities/capabilities.toml
b7888323ee3835d583b68de316e5b59a17f5038c144df6a9e74591d61d9f36bf capabilities/smoke-expectations.txt
d893a6f2a1e7b32c9377c8f5d04cbe570979422820a8ca0c2113db5f6efd0fbb Cargo.lock
2c03da856ec66c6d6407cfe6f007989ac5e48acdf5ac923bf1d1bc7d3d448675 Cargo.toml
bcb0b1a98459bb998f419f9455d049066f7f154272be305f7f07b8d400c92ef2 CHANGELOG.md
4db556995b861e272ab460a3bcd209f51f8a2918cd2c0dfb672ca2994e25fb10 CHANGELOG.md
fa978f37685c47c2209dc2c11e4bb7d278ab47a813b051d1b25ad66e3eafc770 CONTRIBUTING.md
4b490a94642825c10c5876ab94d6e1390360ba754e9615735c649b64a5fea334 docs/adr/0001-rust-first.md
2408920abe6ae8d6c3861f0bcfbe5c3cb362a444fc5104eb5d245fee9334a22d docs/adr/0002-uefi-x86-64-first.md
Expand All @@ -29,13 +30,13 @@ e57c9bfed03a3a425d8592033d8b5fc36146f56b0388ffb8af9c8ec8c75413b3 docs/adr/0008-
6748b021ba78f4bddd20e7f160fbed9d43d6d51e5efff943541ec01168fe4c6c docs/adr/0009-foundation-freeze-memory-ownership.md
756405de996d29dda52dc17c1c3cadc60df9168ae295f9da911f80587d5d5907 docs/adr/0010-page-table-sovereignty.md
012833274e4c031ef4b8b3fe59ae552ac2ad90b03cd3824abc940a91c0ee3b69 docs/adr/0011-private-address-spaces-preemptive-contexts.md
79b25205c83ec732cc2979dca8aba4d10d69d59a4e7fdbbacb6688fd6b26bc4f docs/adr/0012-pci-storage-foundation.md
c34623a530eb46173a5ea13fe59a36607bad539201e0c1e6133e683726348462 docs/architecture/SYSTEM_OVERVIEW.md
9dcd1899544652d376c847cb3fc2c9ac41f9aacad0aa3073edbfc764009dd86e docs/CAPABILITY_MATRIX.md
0eeed4e42af7290bbbf65937e6022b96276130d5070000636e9fc5c250d3a94a docs/process/BACKLOG.md
ce3f0b402a55436dd3039a4a238a50b02d32cf82cfe72cf784a9965f3d7de439 docs/adr/0012-pci-storage-foundation.md
15ec9d23c6f7bca03491c16622606f917a25f6bb9adb9e6bb4dc0e8982fa8e30 docs/architecture/SYSTEM_OVERVIEW.md
ed3365fbec4de8867e55e5295ad86c9b92ff89e05809e2fbfdcaa8bb0329a522 docs/CAPABILITY_MATRIX.md
c6aeeb6ac4ce860b7dfc313cf5590eafc56c37adca2e08a81148d48bda045e55 docs/process/BACKLOG.md
fee8050e8dcc105d812af867282e410f229c2422e535add412d987b4ab70c890 docs/process/DEFINITION_OF_DONE.md
620312efa0d2c090a909a109f0303cdbfb10f6b756be238a41b182f80cf4c76c docs/process/ENVIRONMENT_NOTE.md
ad44783f6526d5ee36291b2800eeae040688ee1f2848fc11d2ddf75c1e4b7524 docs/process/RISK_REGISTER.md
6b5ced505728195064ed19e7518350b2e7a4344d30319805cbdcb9bb2faeffe4 docs/process/RISK_REGISTER.md
146760411de49ec93c4f4a6504f183ecda17e1f0b087816cad37c366de1f6232 docs/process/SDLC.md
53005001ed5a64131b96e384f02a038f7dc3f8af0b5bcfcfbe726544c196ca2e docs/process/SPRINT_0.md
39021ee209e0fe5c981c3a51a5bcbcc9b56551dd8d9e09e87a2498d029d6ce3a docs/process/SPRINT_1.md
Expand All @@ -45,39 +46,41 @@ f1775d368dea5e3970dc3449e2b2431dc4b46c8d3517461e82f9b343575c73ca docs/process/S
5ef377c5d302832ac135ca68a5d2299a1cfefa84fd0cc1df3f2a759160c62734 docs/process/SPRINT_FOUNDATION_1.md
e2e35b9e47bcaa4b909f6d52bd64c56fc02d03ff45e440d4d2f2ae5a207a7b6d docs/process/SPRINT_FOUNDATION_2.md
6f15cc971ee785b6211dfa469d345c13dc7ef6b65ab484adb9be0b76bf5ebec9 docs/process/SPRINT_FOUNDATION_3.md
981704eafdbf4b39bb8b980498a18d2e8c57f32a6131445b4e951212ba6366a4 docs/process/SPRINT_M6_STORAGE_FOUNDATION.md
d9033107b5c62800cec539c6fb47852b07a8c49cfc17e9b28671307504642fbf docs/process/SPRINT_M6_STORAGE_FOUNDATION.md
695d5c8f71075cc6f377a12c222d2b95e010192a7c6a428d6f3e830dcab8c7c2 docs/requirements/PRODUCT_REQUIREMENTS.md
b23b8df9b60a0a710ee485bffbdb63e7eed15e1c64e6ae1d022cc1f9e587f878 docs/security/THREAT_MODEL.md
5202f65d8d18c168efa2695cbdeb24a0e89d08b0a842b22825891b23e001de38 docs/security/THREAT_MODEL.md
80e655063c71d86e90895b289c57a61a127e2ea2b0ee8dfb26bbe78e032f027f docs/testing/FOUNDATION_HARDENING_1_VALIDATION.md
a7706bae9b2288ef67a77263af7ef0672eeec34c0d9331671cda04cf0858c39f docs/testing/FOUNDATION_HARDENING_2_VALIDATION.md
d9c7d5e718be2f21f50408551733c5860c04745bd4dd55c78b3876827cb1ea21 docs/testing/FOUNDATION_HARDENING_3_VALIDATION.md
96c4481cfdf866564988c8a590a7c9f10b56df370ed084d245c8e7d54258cf03 docs/testing/M2_VALIDATION.md
2e5a291acec6351b594166f9cb8a6107dc47fd4c421557fbafbfaf4eef3d9ff5 docs/testing/M4_VALIDATION.md
23c88c5b3bc0452637af6d8632234bd0be74ed6e356268cf02e24b4bd7d3e125 docs/testing/M5_VALIDATION.md
ca41b8558018f1e32ffdf570f061c60dc9914f781ae17f755d2c6402607eb67e docs/testing/M6A_PCI_DISCOVERY_VALIDATION.md
c44ac254c3cbf6a934a65a241103ed7c03db1036ed73444e10ab11b662052be5 docs/testing/TEST_STRATEGY.md
82ad6b17dc1b2041f2052479019c270980251e35b5519b6ec98bcd0e3b5e0d08 kernel/Cargo.toml
c4556e45804712a1f0382fdbd2d4e4fecdf467c95a867a3d16ef0a8aaa515fc7 docs/testing/M6B_BLOCK_TRANSPORT_VALIDATION.md
2bcd201649ceaade95bc0621f1a1824625285dfe43a8f125b5e3866bb5d87bb8 docs/testing/TEST_STRATEGY.md
e16e6e8ee0ab798bd3c226fb83c81080cdce5069fe15b3d23180eaf7dec58a94 kernel/Cargo.toml
528774183d2c2c8a809b796a1dad91a336462bfd589255007da6d0447ffff04c kernel/src/block.rs
0f8884112d25f779cff472251105301b160b4368ee6aeca421eff75242a4404e kernel/src/boot_info.rs
069853672f94c05025c9342485c3f00453d76c95a228302e01b9ebff47a072a6 kernel/src/capabilities.rs
8010bfaa835197b850c4a45e007f8b74b72c1de78673ebf3f0bedddd5912cf5d kernel/src/elf.rs
d2b8bfdd1472b3e75dd46a5f7d9752bcb70482b9b6c590e4579660b8ffc52b49 kernel/src/fs.rs
7534cd58803b08368b411c3e13b772c1d21567e76574fa67bdfbcdd7f1d21962 kernel/src/generated/capabilities.rs
93cac7beda0b9046a540c113f09439cd81dbb91a60a0a581d99ab5403a6ef8cc kernel/src/generated/capabilities.rs
ae5160fc6d70367b7758afac6876faeb3c9e7766411b4dc1fc3ac10fa28dafa8 kernel/src/generated/mod.rs
e6d19b13631029aefb179636a8b2cf20dad347bf2bc89365133912271c758008 kernel/src/heap.rs
9b88a5d4c56554cb1c4bd646925b28bc97a3feb4d3d6c576b5dc33dbe8496d02 kernel/src/input.rs
6fd92163f262578c23d9da284e34698853827e7ca0daf4efe986c1fb1339137b kernel/src/lib.rs
96df539fab698d08533d90ae8ce5df92e57982b6d121fe92e9003b32886c3300 kernel/src/lib.rs
472d2bb193b4c3449807927e2059db0ed94ea7218c3238f7f082aeda65582683 kernel/src/memory.rs
6188979546aeab5b63216056d9d148184fe89ede5226726b9c8c29471c0717a0 kernel/src/ownership.rs
52dabe4f896d71aa0dd67716cd2660ce1b96550a32ead52836185138384f4ba6 kernel/src/paging.rs
8f006b9915d50fa565b63d6aa0fa24fafa3ef1f73b109a2b6ee17b4605ef2adf kernel/src/pci.rs
f0ad8e59490e98186eb44b4dae04a42be46aae6b669e34b6548efa6646dbae82 kernel/src/pci.rs
b36eff431fd41dada1848ccc363ac9a66f1c1ff38f99cb2e16a8655820ebbe06 kernel/src/process.rs
18426c0070887453f9de8a816927fe2c2b3cec57e40f90ef152d67546a462ca3 kernel/src/scheduler.rs
0d2ac72180b1e28d13c027f9994869929d3f5da475c111f2d528c7ddc601fdce kernel/src/shell.rs
f8518120e136c8073262134ed4cd08a22643d933e1287d17ad9f04324f06a102 kernel/src/shell.rs
453d92ba90decb230785feeb9d7b56cc0ba583c52237c550ce6fb2889304f9df kernel/src/startup.rs
d47014298e0006dc63b6c346a5e823d1208891d91ccf9987fc8c46fe351e26bd kernel/src/syscall.rs
b818e7d3c53abc2d759daca8bb901c43fb62aa7ab3804f9f6269e42247260898 Makefile
ba43bce2aaf5c212f33f3bda0c22f6c142c5d263f71348836e837fe50c82b3e4 PROJECT.md
cc13aa490db14684f53c349c89876e89199dad6c75c883bdb39680a315e4ae1e README.md
1905ee7c842ee951d0d41c465f0cf51755d756fcd4d28bec6dcdf217d9512256 PROJECT.md
acc46103cc5755aa4937f5beb584c8b2a377127b2e9ed82cd8e8e12d4e5ea81f README.md
5aa479510db257bb2f5c82eb11fbbd3c30d1cc5ee70864dd9af5b2387e709c43 rust-toolchain.toml
cd7c4d2ac3a81f614a8134661c0353e238ea19d4cb000bf98143a8e5f4a9a521 scripts/build-llvm-probe.sh
c26e150f860ee56bc77d7181d7ff3514b32615e17a21494c33c6a159108cb528 scripts/build-smoke.sh
Expand All @@ -87,10 +90,10 @@ f5e3a26817aecf454c61b0bb0ff5f86fd03d7a3fb0ece74c67f1913a4dd94a74 scripts/find-o
fc3cabdfc9f29ed493ae266ac73d19183224031d15f53d1e770b15ebaabe00ce scripts/generate-capabilities.py
b6b36fc8d1c06cb824cae32821646d6e1f70946a761ca492a77e4f1dbbbcb749 scripts/generate-source-manifest.py
b424e16e3444699ec89bb3d84e4e44c2dfaf4631431d26c88cc6a0e9e957cf42 scripts/image.sh
267ec27aecc9a0d8018dea651e411ba73447bb5456995219ae0ce3f30984ec42 scripts/run-qemu.sh
5ae79499617b1d5d44b0ff7f7d797606d1b8eb3a47081af0b36ac006269bd64e scripts/run-qemu.sh
52b6d67fe1d6c035a5bcee7b777b431d2d95645f9b0f26ac88f3130823b11e86 scripts/setup.sh
eb4590c3cd98ab169bcc023b130468c732dbbc7d1e05ed75cc8cc3b7eda76fca scripts/smoke-test.sh
877f1adcb675cc970c29c8a09f6841dc2826e8372ed7cd5997e6a4b503dfcad5 scripts/source-check.py
49f0f15e67fdf0dc91c12721ae201b9dfdc1413a6523c2a67914578a956abcae scripts/smoke-test.sh
d1be8a69d910175edec5c1a86d3bfaa9d3a221eb7dcb7ffbaae53afdd3e03095 scripts/source-check.py
4cd8845ab8db1a1702165dcd7b777917804a285a06a5270226aff85e8a53280a scripts/verify-llvm-probe.sh
1ab4c9f09e95c0779b58e3e792ead2eeaa53291cc1804e405f7ec6635223383d SECURITY.md
88cf4ef34b86ae3e33b04d4f1b7e67a15778d88e1728be97982c679a52361a82 user/programs/bin/fault-test.elf
Expand Down
2 changes: 1 addition & 1 deletion boot/uefi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "sanju-boot"
version = "0.0.9"
version = "0.0.10"
edition.workspace = true
rust-version.workspace = true
publish.workspace = true
Expand Down
2 changes: 2 additions & 0 deletions boot/uefi/src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
pub(crate) mod paging;
mod pci;
mod serial;
mod virtio_block;

#[cfg(feature = "qemu-test")]
pub mod qemu;
Expand All @@ -14,6 +15,7 @@ pub(crate) use paging::{
};
pub(crate) use pci::discover_pci;
pub use serial::SerialConsole;
pub(crate) use virtio_block::initialize_and_probe as initialize_virtio_block;

use core::arch::{asm, global_asm};
use core::mem::size_of;
Expand Down
Loading
Loading