WIP: Retain original x86 startup allocations in the boot handoff #29

Draft
erikinkinen wants to merge 18 commits from feature/x86-startup-resources into feature/current-handoff-v2
Owner

Allocate separate low-memory trampoline and real-mode stack pages through live UEFI services, and keep the BSP stack in scoped page ownership. Serialize the original PML4, table arena, BSP stack and scratch extents in BootKernel v2.1; preserve every allocation as bootloader-owned memory through normalization and console handoff rebuilds. Partial failures release the original owners, and successful firmware exit consumes their obsolete cleanup handles.

Implements #28; depends on #26, lib-handoff#9 and lib-bootimg#4. See the producer contract and the coordinated manual.

  • Retain actual startup allocations and original paging/BSP stack extents through handover.
  • Cover wire layout, reservation gaps, malformed geometry and output bounds in compiled producer tests.
  • Pass all eleven original component gates and build actual UEFI binaries with and without the development console, without compiler warnings.
  • Complete current-head public CI.
  • Complete coordinated native 1-, 2- and 4-CPU acceptance, including allocation failure cleanup and uncertain startup retention.

This branch also includes the completed downstream features from #30, #32, #36.

Allocate separate low-memory trampoline and real-mode stack pages through live UEFI services, and keep the BSP stack in scoped page ownership. Serialize the original PML4, table arena, BSP stack and scratch extents in BootKernel v2.1; preserve every allocation as bootloader-owned memory through normalization and console handoff rebuilds. Partial failures release the original owners, and successful firmware exit consumes their obsolete cleanup handles. Implements #28; depends on #26, [lib-handoff#9](https://git.erikinkinen.fi/erix/lib-handoff/pulls/9) and [lib-bootimg#4](https://git.erikinkinen.fi/erix/lib-bootimg/pulls/4). See [the producer contract](https://git.erikinkinen.fi/erix/bootloader/src/branch/feature/x86-startup-resources/docs/startup-resources.md) and [the coordinated manual](https://git.erikinkinen.fi/erix/docs/pulls/98). - [x] Retain actual startup allocations and original paging/BSP stack extents through handover. - [x] Cover wire layout, reservation gaps, malformed geometry and output bounds in compiled producer tests. - [x] Pass all eleven original component gates and build actual UEFI binaries with and without the development console, without compiler warnings. - [x] Complete current-head public CI. - [ ] Complete coordinated native 1-, 2- and 4-CPU acceptance, including allocation failure cleanup and uncertain startup retention. This branch also includes the completed downstream features from #30, #32, #36.
erikinkinen added this to the Alpha 1 milestone 2026-11-13 08:54:02 +01:00
Allocate separate low trampoline and real-mode stack pages through live UEFI services and preserve their original ownership through cleanup or firmware exit. Serialize their actual extents with the original PML4, table arena and BSP stack in the coordinated BootKernel v2.1 record. Include every retained allocation in normalization and handoff capacity, reject incomplete reservations before publication, and use the explicit public wire supplier without changing Cargo source identities.
Use the existing typed page owner for the original BSP stack so every pre-exit failure releases it, then consume that owner only after successful handover reservation. Select the existing public boot-image source-policy supplier to preserve the complete main-branch dependency graph without rewriting manifests or limits.
fix: Validate complete startup reservations before sealing the handoff
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 2s
CI / test (push) Successful in 44s
4614016aac
Use the complete handoff validator after encoding so a missing retained scratch page cannot produce a successful construction result. Header decoding alone checks field shape but does not establish memory-map coverage.
Run the unchanged native population algorithm on explicitly owned hosted table bytes. Preserve strict arena accounting and check actual leaves, compatible rounded LOAD sharing, read-only identity policy and refusal of conflicting backing before mapping effects. Hosted storage makes no firmware placement or execution claim.
Compile the real page planner and mapper in hosted owned-byte controls without importing the native-only arena initialization helper. Preserve mandatory warnings and the original mapping behavior for the pre-fix regression capture.
Count only page tables actually needed by writable identity reuse, and split original large leaves when a requested page must be read-only. Preflight canonical byte geometry and sorted overlapping requests before table writes, refusing changed backing, conflicting write policy and reserved routes. Keep exact used-versus-owned arena accounting and preserve neighboring original leaves.
Refuse conflicting controller descriptors before population and exercise canonical, recursive-slot and byte-offset rejection. Verify one split table preserves separate read-only and writable requested pages without widening their policy.
Use the actual original planned page count for conflicting requests so an excess test allocation cannot accidentally satisfy the expected refusal through the strict final arena gate.
Convert the handoff usize selector explicitly before forming the canonical reserved window, preserving checked mapping admission and the independent negative fixture.
Keep the same architectural rejection while using the standard interval predicate required by strict Clippy.
docs: Explain exact bootstrap paging and genuine shared-page controls
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 2s
CI / test (push) Successful in 44s
814d28416f
Document original arena custody, read-only identity splitting and compatible page sharing alongside their authority boundaries. Use two disjoint byte intervals that actually share a rounded page, with explicit boundary assertions, rather than an adjacent-page fixture.
feat: Merge exact bootstrap page-table backing and permissions
Some checks failed
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / test (push) Has been cancelled
CI / markdown (push) Has been cancelled
6f64d18178
Preserve exact bootstrap page-table backing and permissions. Integrate the reviewed feature into feature/x86-startup-resources while the upstream work retains its own completion requirements.

#30
Keep ACPI reads within the genuine live UEFI source and its original descriptor types and read policy. Copy enabled full-width identities into the versioned counted handoff, retain startup resource geometry across rebuilds, and release temporary discovery storage before firmware exit. Replace the pointer handoff and extra firmware identity mappings with immutable data.
Treat memory-map attributes as capabilities rather than current protection settings, following the UEFI source contract. Remove the obsolete transition import, exercise both allocation refusals through the actual capture transaction, and document data-only handover and pre-exit cleanup.
fix: Reject malformed firmware descriptor page geometry
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 2s
CI / test (push) Successful in 45s
8d98cb7339
Require the nonempty page-aligned ranges specified by UEFI before using original descriptors to bound any table span. Cover zero-page and misaligned inputs alongside gaps, overlaps and overflow so malformed map geometry cannot become a read boundary.
feat: Merge capture bounded firmware processor topology before handover
Some checks failed
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / test (push) Has been cancelled
CI / markdown (push) Has been cancelled
2e91a01224
Capture bounded firmware processor topology before handover. Integrate the reviewed feature into feature/x86-startup-resources while the upstream work retains its own completion requirements.

#32
fix: Require an explicit Kernel runtime provider contract
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / markdown (push) Successful in 2s
CI / test (push) Successful in 47s
0776f2cc82
Resolve compiler-runtime fallback imports only through an exact authenticated declaration and a real definition in the original Kernel load segments. Remove name-prefix guesses, reject malformed or duplicate contracts and keep unrelated Kernel symbols outside the fallback scope. This permits legitimate compiler trait imports without granting a broader namespace.
feat: Merge resolve exact Kernel compiler-runtime exports
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / test (push) Successful in 59s
CI / markdown (push) Successful in 2s
fc3b1898f1
Resolve exact Kernel compiler-runtime exports. Integrate the reviewed feature into feature/x86-startup-resources while the upstream work retains its own completion requirements.

#36
Author
Owner

Merged the approved downstream work from #30, #32, #36. The upstream PR retains its own remaining scope and completion requirements.

Merged the approved downstream work from #30, #32, #36. The upstream PR retains its own remaining scope and completion requirements.
Author
Owner

Published the complete signed startup preparation ca95b00c on feature/x86-startup-resources-merge-ready-ca95b00c, with distinct startup-resource, exact page-policy, bounded firmware-topology and explicit runtime-provider boundaries. It builds on the separately prepared artifact and counted-handoff parent.

All 18 component gates passed without warnings against frozen genuine main suppliers, including 77 component and seven linker-policy controls in each configuration. Production export-definition controls cover the original 42 negative spellings plus malformed tables, visibility, backing and collisions. Whole-EFI comparisons in both runtime configurations and PDB associations also passed. Exact-head public CI is queued.

This remains WIP and Pending exact human review. The complete runtime-export producer, paired native images, 1/2/4-CPU topology and SMP execution, and mounted-barrier RW/RO acceptance remain open. Component checks do not attest firmware or guest execution. Original source refs and the selected image catalog are retained.

Published the complete signed startup preparation [ca95b00c](https://git.erikinkinen.fi/erix/bootloader/commit/ca95b00cf953988a26fa78dd3ea09d334b18426e) on `feature/x86-startup-resources-merge-ready-ca95b00c`, with distinct startup-resource, exact page-policy, bounded firmware-topology and explicit runtime-provider boundaries. It builds on the separately prepared artifact and counted-handoff parent. All 18 component gates passed without warnings against frozen genuine main suppliers, including 77 component and seven linker-policy controls in each configuration. Production export-definition controls cover the original 42 negative spellings plus malformed tables, visibility, backing and collisions. Whole-EFI comparisons in both runtime configurations and PDB associations also passed. [Exact-head public CI](https://git.erikinkinen.fi/erix/bootloader/actions/runs/335) is queued. This remains WIP and Pending exact human review. The complete [runtime-export producer](https://git.erikinkinen.fi/erix/integration/pulls/783), paired native images, 1/2/4-CPU topology and SMP execution, and mounted-barrier RW/RO acceptance remain open. Component checks do not attest firmware or guest execution. Original source refs and the selected image catalog are retained.
Author
Owner

Exact prepared-head CI46770 completed successfully at ca95b00c: all 24 test-job and four Markdown steps passed. The retained raw logs contain no compiler, test, build or rustdoc warnings; the standard host CA setup line is recorded separately.

The preparation remains Pending exact human review. The paired native/image and coordinated topology/SMP acceptance requirements remain open; component CI does not attest those executions.

Exact prepared-head [CI46770](https://git.erikinkinen.fi/erix/bootloader/actions/runs/335) completed successfully at `ca95b00c`: all 24 test-job and four Markdown steps passed. The retained raw logs contain no compiler, test, build or rustdoc warnings; the standard host CA setup line is recorded separately. The preparation remains Pending exact human review. The paired native/image and coordinated topology/SMP acceptance requirements remain open; component CI does not attest those executions.
All checks were successful
CI / test (pull_request) Has been skipped
CI / markdown (pull_request) Has been skipped
CI / test (push) Successful in 59s
CI / markdown (push) Successful in 2s
This pull request is marked as a work in progress.
View command line instructions

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin 'feature/x86-startup-resources:feature/x86-startup-resources'
git switch 'feature/x86-startup-resources'

Merge

Merge the changes and update on Forgejo.

Warning: The "Autodetect manual merge" setting is not enabled for this repository, you will have to mark this pull request as manually merged afterwards.

git switch 'feature/current-handoff-v2'
git merge --no-ff 'feature/x86-startup-resources'
git switch 'feature/x86-startup-resources'
git rebase 'feature/current-handoff-v2'
git switch 'feature/current-handoff-v2'
git merge --ff-only 'feature/x86-startup-resources'
git switch 'feature/x86-startup-resources'
git rebase 'feature/current-handoff-v2'
git switch 'feature/current-handoff-v2'
git merge --no-ff 'feature/x86-startup-resources'
git switch 'feature/current-handoff-v2'
git merge --squash 'feature/x86-startup-resources'
git switch 'feature/current-handoff-v2'
git merge --ff-only 'feature/x86-startup-resources'
git switch 'feature/current-handoff-v2'
git merge 'feature/x86-startup-resources'
git push origin 'feature/current-handoff-v2'
Sign in to join this conversation.
No description provided.