Skip to content

Kernel API work#343

Draft
berkus wants to merge 107 commits intodevelopfrom
feat/kernel-api
Draft

Kernel API work#343
berkus wants to merge 107 commits intodevelopfrom
feat/kernel-api

Conversation

@berkus
Copy link
Copy Markdown
Member

@berkus berkus commented Feb 21, 2026

Closes #43
Closes #57

@semanticdiff-com
Copy link
Copy Markdown

semanticdiff-com Bot commented Feb 21, 2026

Review changes with  SemanticDiff

Changed Files
File Status
  libs/alloc/src/bump_allocator.rs  82% smaller
  libs/platform/src/raspberrypi/exception/asynchronous.rs  77% smaller
  libs/platform/src/raspberrypi/device_driver/arm/gicv2/mod.rs  69% smaller
  kernel/nucleus/build.rs  64% smaller
  libs/print/src/lib.rs  61% smaller
  libs/platform/src/raspberrypi/device_driver/bcm/mini_uart.rs  59% smaller
  libs/platform/src/raspberrypi/drivers.rs  57% smaller
  libs/platform/src/raspberrypi/device_driver/bcm/power.rs  53% smaller
  libs/platform/src/raspberrypi/device_driver/arm/gicv2/gicd.rs  52% smaller
  libs/exception/src/arch/aarch64/debug.rs  49% smaller
  libs/platform/src/raspberrypi/device_driver/bcm/interrupt_controller/peripheral_ic.rs  47% smaller
  libs/platform/src/raspberrypi/device_driver/arm/gicv2/gicc.rs  34% smaller
  bin/chainboot/src/main.rs  31% smaller
  libs/log/src/lib.rs  27% smaller
  libs/memory/src/arch/aarch64/mod.rs  23% smaller
  libs/mapping/src/mapping_record.rs  23% smaller
  libs/platform/src/raspberrypi/device_driver/bcm/interrupt_controller/mod.rs  15% smaller
  libs/qemu/src/lib.rs  14% smaller
  libs/memory/src/arch/mod.rs  12% smaller
  libs/boot/src/arch/aarch64/boot.rs  12% smaller
  libs/platform/src/raspberrypi/device_driver/bcm/pl011_uart.rs  9% smaller
  libs/address/src/align.rs  9% smaller
  libs/memory/src/lib.rs  7% smaller
  libs/platform/src/lib.rs  6% smaller
  .zed/settings.json  5% smaller
  libs/exception/src/lib.rs  4% smaller
  libs/exception/src/arch/aarch64/mod.rs  2% smaller
  .cargo/config.toml Unsupported file format
  .github/dependabot.yaml  0% smaller
  .github/dependabot.yml  0% smaller
  .github/shared/qemu/action.yaml  0% smaller
  .github/shared/setup/action.yaml  0% smaller
  .github/workflows/build.yaml  0% smaller
  .github/workflows/build.yml  0% smaller
  .github/workflows/cog.yaml  0% smaller
  Cargo.lock Unsupported file format
  Cargo.toml Unsupported file format
  Justfile Unsupported file format
  Makefile.toml Unsupported file format
  bin/chainboot/Cargo.toml Unsupported file format
  bin/chainboot/Makefile.toml Unsupported file format
  bin/chainboot/tests/chainboot.rs  0% smaller
  bin/chainofcommand/Cargo.toml Unsupported file format
  bin/chainofcommand/Makefile.toml Unsupported file format
  doc/Power_ePAPR_APPROVED_v1.1.pdf Unsupported file format
  doc/devicetree-specification-v0.3.pdf Unsupported file format
  emulation/layout.zellij Unsupported file format
  kernel/Plan.md Unsupported file format
  kernel/kernel.map Unsupported file format
  kernel/kickstart/Cargo.toml Unsupported file format
  kernel/kickstart/DTB_devices_rpi3.txt Unsupported file format
  kernel/kickstart/build.rs  0% smaller
  kernel/kickstart/kernel_sections.template.rs Unsupported file format
  kernel/kickstart/src/boot_info.rs  0% smaller
  kernel/kickstart/src/device_tree.rs  0% smaller
  kernel/kickstart/src/el_switch.rs  0% smaller
  kernel/kickstart/src/embed.rs  0% smaller
  kernel/kickstart/src/loader.rs  0% smaller
  kernel/kickstart/src/main.rs  0% smaller
  kernel/kickstart/src/memory.rs  0% smaller
  kernel/kickstart/src/paging.rs  0% smaller
  kernel/kickstart/src/qsort.rs  0% smaller
  kernel/nucleus/Cargo.toml Unsupported file format
  kernel/nucleus/design.md Unsupported file format
  kernel/nucleus/src/api/arch/asid.rs  0% smaller
  kernel/nucleus/src/api/arch/asid_pool.rs  0% smaller
  kernel/nucleus/src/api/arch/frame.rs  0% smaller
  kernel/nucleus/src/api/arch/mod.rs  0% smaller
  kernel/nucleus/src/api/arch/page_table.rs  0% smaller
  kernel/nucleus/src/api/arch/vspace.rs  0% smaller
  kernel/nucleus/src/api/buffer.rs  0% smaller
  kernel/nucleus/src/api/debug_console.rs  0% smaller
  kernel/nucleus/src/api/domain.rs  0% smaller
  kernel/nucleus/src/api/endpoint.rs  0% smaller
  kernel/nucleus/src/api/event_count.rs  0% smaller
  kernel/nucleus/src/api/key_entry.rs  0% smaller
  kernel/nucleus/src/api/key_table.rs  0% smaller
  kernel/nucleus/src/api/mod.rs  0% smaller
  kernel/nucleus/src/api/notification.rs  0% smaller
  kernel/nucleus/src/api/reply.rs  0% smaller
  kernel/nucleus/src/api/time.rs  0% smaller
  kernel/nucleus/src/api/untyped.rs  0% smaller
  kernel/nucleus/src/main.rs  0% smaller
  kernel/nucleus/src/objects/arch/aarch64_objects.rs  0% smaller
  kernel/nucleus/src/objects/arch/arch_pools.rs  0% smaller
  kernel/nucleus/src/objects/arch/asid.rs  0% smaller
  kernel/nucleus/src/objects/arch/asid_pool.rs  0% smaller
  kernel/nucleus/src/objects/arch/frame.rs  0% smaller
  kernel/nucleus/src/objects/arch/mod.rs  0% smaller
  kernel/nucleus/src/objects/arch/page_table.rs  0% smaller
  kernel/nucleus/src/objects/arch/vspace.rs  0% smaller
  kernel/nucleus/src/objects/arch_objects.rs  0% smaller
  kernel/nucleus/src/objects/buffer.rs  0% smaller
  kernel/nucleus/src/objects/debug_console.rs  0% smaller
  kernel/nucleus/src/objects/domain.rs  0% smaller
  kernel/nucleus/src/objects/endpoint.rs  0% smaller
  kernel/nucleus/src/objects/event_count.rs  0% smaller
  kernel/nucleus/src/objects/key_table.rs  0% smaller
  kernel/nucleus/src/objects/mod.rs  0% smaller
  kernel/nucleus/src/objects/notification.rs  0% smaller
  kernel/nucleus/src/objects/nucleus.rs  0% smaller
  kernel/nucleus/src/objects/nucleus_object.rs  0% smaller
  kernel/nucleus/src/objects/object_pool.rs  0% smaller
  kernel/nucleus/src/objects/object_ref.rs  0% smaller
  kernel/nucleus/src/objects/reply.rs  0% smaller
  kernel/nucleus/src/objects/time.rs  0% smaller
  kernel/nucleus/src/objects/untyped.rs  0% smaller
  libs/address/Cargo.toml Unsupported file format
  libs/address/README.md Unsupported file format
  libs/address/src/lib.rs Unsupported file format
  libs/address/tests/address.rs  0% smaller
  libs/alloc/Cargo.toml Unsupported file format
  libs/alloc/src/lib.rs  0% smaller
  libs/boot/Cargo.toml Unsupported file format
  libs/boot/src/arch/aarch64/boot.s Unsupported file format
  libs/console/Cargo.toml Unsupported file format
  libs/console/src/lib.rs  0% smaller
  libs/cpu/Cargo.toml Unsupported file format
  libs/driver/Cargo.toml Unsupported file format
  libs/exception/Cargo.toml Unsupported file format
  libs/exception/src/arch/aarch64/esr_el1.rs  0% smaller
  libs/exception/src/arch/aarch64/exception/mod.rs  0% smaller
  libs/exception/src/arch/aarch64/exception_context.rs  0% smaller
  libs/exception/src/arch/aarch64/spsr_el1.rs  0% smaller
  libs/exception/src/arch/aarch64/vectors.S Unsupported file format
  libs/exception/src/arch/mod.rs  0% smaller
  libs/exception/src/asynchronous/mod.rs  0% smaller
  libs/exception/src/exception/mod.rs  0% smaller
  libs/exception/tests/exception.rs  0% smaller
  libs/kernel-state/Cargo.toml Unsupported file format
  libs/kernel-state/src/lib.rs  0% smaller
  libs/local-irq/Cargo.toml Unsupported file format
  libs/local-irq/src/lib.rs  0% smaller
  libs/locking/Cargo.toml Unsupported file format
  libs/locking/src/lib.rs  0% smaller
  libs/locking/tests/locking.rs  0% smaller
  libs/log/Cargo.toml Unsupported file format
  libs/machine/Cargo.toml Unsupported file format
  libs/mapping/Cargo.toml Unsupported file format
  libs/mapping/README.md Unsupported file format
  libs/mapping/src/lib.rs  0% smaller
  libs/mapping/src/mapping_attributes.rs  0% smaller
  libs/mapping/src/memory_region.rs Unsupported file format
  libs/mapping/src/page_address.rs Unsupported file format
  libs/memory/Cargo.toml Unsupported file format
  libs/memory/README.md Unsupported file format
  libs/memory/TODO.md Unsupported file format
  libs/memory/docs/970MP_um.2008MAR07_pub.pdf Unsupported file format
  libs/memory/docs/paging.puml Unsupported file format
  libs/memory/src/arch/aarch64/README.md Unsupported file format
  libs/memory/src/arch/aarch64/addr/asid.rs  0% smaller
  libs/memory/src/arch/aarch64/addr/mod.rs  0% smaller
  libs/memory/src/arch/aarch64/common.rs  0% smaller
  libs/memory/src/arch/aarch64/features.rs  0% smaller
  libs/memory/src/arch/aarch64/granule_16k.rs  0% smaller
  libs/memory/src/arch/aarch64/granule_4k.rs  0% smaller
  libs/memory/src/arch/aarch64/granule_64k.rs  0% smaller
  libs/memory/src/arch/aarch64/mmu.rs  0% smaller
  libs/memory/src/arch/aarch64/mmu/mod.rs  0% smaller
  libs/memory/src/arch/aarch64/mmu/translation_table.rs  0% smaller
  libs/memory/src/arch/powerpc.rs  0% smaller
  libs/memory/src/arch/riscv64.rs  0% smaller
  libs/memory/src/arch/x86_64.rs  0% smaller
  libs/memory/src/arch_trait.rs  0% smaller
  libs/memory/src/error.rs  0% smaller
  libs/memory/src/mmu/mod.rs  0% smaller
  libs/memory/src/mmu/page_alloc.rs  0% smaller
  libs/memory/src/mmu/translation_table.rs  0% smaller
  libs/memory/src/mmu/types.rs  0% smaller
  libs/memory/src/mmu/unused.rs  0% smaller
  libs/memory/src/phys_addr.rs  0% smaller
  libs/memory/src/platform/README.md Unsupported file format
  libs/memory/src/platform/mod.rs  0% smaller
  libs/memory/src/platform/raspberrypi/memory/mmu.rs  0% smaller
  libs/memory/src/platform/raspberrypi/memory/mod.rs  0% smaller
  libs/memory/src/platform/raspberrypi/mod.rs  0% smaller
  libs/memory/src/table.rs  0% smaller
  libs/memory/src/virt_addr.rs  0% smaller
  libs/memory/src/walk.rs  0% smaller
  libs/mmio/Cargo.toml Unsupported file format
  libs/mmio/README.md Unsupported file format
  libs/mmio/src/lib.rs  0% smaller
  libs/mmio/src/mmio_descriptor.rs  0% smaller
  libs/object/Cargo.toml Unsupported file format
  libs/object/src/arch/asid_pool.rs  0% smaller
  libs/object/src/arch/frame.rs  0% smaller
  libs/object/src/arch/page_table.rs  0% smaller
  libs/object/src/arch/vspace.rs  0% smaller
  libs/object/src/buffer.rs  0% smaller
  libs/object/src/debug_console.rs  0% smaller
  libs/object/src/domain.rs  0% smaller
  libs/object/src/endpoint.rs  0% smaller
  libs/object/src/event_count.rs  0% smaller
  libs/object/src/key.rs  0% smaller
  libs/object/src/key_table.rs  0% smaller
  libs/object/src/lib.rs  0% smaller
  libs/object/src/notification.rs  0% smaller
  libs/object/src/object_type.rs  0% smaller
  libs/object/src/reply.rs  0% smaller
  libs/object/src/rights.rs  0% smaller
  libs/object/src/time.rs  0% smaller
  libs/object/src/untyped.rs  0% smaller
  libs/platform/Cargo.toml Unsupported file format
  libs/platform/README.md Unsupported file format
  libs/platform/src/platform/README.md Unsupported file format
  libs/platform/src/platform/mod.rs  0% smaller
  libs/platform/src/platform/raspberrypi/linker/kernel.ld Unsupported file format
  libs/platform/src/raspberrypi/cpu.rs  0% smaller
  libs/platform/src/raspberrypi/device_driver/arm/mod.rs  0% smaller
  libs/platform/src/raspberrypi/device_driver/bcm/gpio.rs Unsupported file format
  libs/platform/src/raspberrypi/device_driver/bcm/mailbox.rs  0% smaller
  libs/platform/src/raspberrypi/device_driver/bcm/mailbox_refactor.rs  0% smaller
  libs/platform/src/raspberrypi/device_driver/bcm/mod.rs  0% smaller
  libs/platform/src/raspberrypi/device_driver/mod.rs  0% smaller
  libs/platform/src/raspberrypi/display.rs  0% smaller
  libs/platform/src/raspberrypi/exception/mod.rs  0% smaller
  libs/platform/src/raspberrypi/fb.rs  0% smaller
  libs/platform/src/raspberrypi/linker/kickstart.ld Unsupported file format
  libs/platform/src/raspberrypi/linker/nucleus.ld Unsupported file format
  libs/platform/src/raspberrypi/linker/test.ld Unsupported file format
  libs/platform/src/raspberrypi/memory.rs  0% smaller
  libs/platform/src/raspberrypi/mod.rs  0% smaller
  libs/platform/src/raspberrypi/vc.rs  0% smaller
  libs/platform/tests/platform.rs  0% smaller
  libs/primitives/Cargo.toml Unsupported file format
  libs/print/Cargo.toml Unsupported file format
  libs/print/tests/print.rs  0% smaller
  libs/qemu/Cargo.toml Unsupported file format
  libs/syscall/Cargo.toml Unsupported file format
  libs/syscall/src/lib.rs  0% smaller
  libs/test/Cargo.toml Unsupported file format
  libs/test/src/lib.rs  0% smaller
  libs/time/Cargo.toml Unsupported file format
  nucleus/Makefile.toml Unsupported file format
  nucleus/src/main.rs  0% smaller
  nucleus/tests/memory.rs  0% smaller
  nucleus/tests/nucleus.rs  0% smaller
  targets/aarch64-metta-none-eabi.json  0% smaller
  targets/bcm2708-rpi-zero-w.dtb Unsupported file format
  targets/bcm2710-rpi-3-b-plus.dtb Unsupported file format
  tests/allocator.rs  0% smaller
  tests/common/mod.rs  0% smaller
  tests/mapping.rs  0% smaller
  tests/memory.rs  0% smaller
  tests/nucleus.rs  0% smaller
  userspace/README.md Unsupported file format
  userspace/graphics.rs  0% smaller
  userspace/privileged/process.rs  0% smaller
  userspace/privileged/scheduler.rs  0% smaller
  userspace/shell.rs  0% smaller

@berkus berkus force-pushed the feat/kernel-api branch 2 times, most recently from 2f5bbcd to c274880 Compare February 21, 2026 21:42
@berkus berkus self-assigned this Feb 21, 2026
@berkus berkus force-pushed the feat/kernel-api branch 2 times, most recently from ebadc68 to bf4373f Compare February 21, 2026 23:07
@metta-systems metta-systems deleted a comment from cocogitto-bot Bot Feb 21, 2026
@berkus berkus force-pushed the feat/kernel-api branch 5 times, most recently from 0d24184 to 863b146 Compare February 22, 2026 12:24
@berkus berkus force-pushed the feat/kernel-api branch 7 times, most recently from bffb2a5 to d8d7c00 Compare February 27, 2026 10:06
@berkus berkus force-pushed the feat/kernel-api branch from d8d7c00 to cae02f5 Compare March 3, 2026 00:36
berkus added 9 commits March 4, 2026 00:36
wip: ignore addresses top byte

wip: add CnP docs

wip: mmu debug

wip: disable old code

wip: debug mmu init - more init flags

wip: add fixme
wip: 🚧 play with memory tables separately - this compiles so far

wip: 🚧 try impl Index for Stages

wip: 🚧 page allocator

wip: 🚧 playing with mem tables

wip: 🚧 reorder fields

wip: 🚧 more playing with mem tables

wip: 🚧 continue memtab2 experiment

wip: 🚧 continue memtab2 experiment

wip: 🚧 conceptually we want something like this

wip: 🚧 cleanup, no paste needed

wip: 🚧 only output casts and NextStage's Either remain

wip: 🚧 compiles

wip: 🚧 this almost works

wip: 🚧 compiles

wip: 🚧 what we want to achieve for construction…

wip: 🚧 keep going with memtab2

wip: 🚧 work on indexmut

wip: 🚧 memtab work

wip mmu plans -- readme

doc: add init memory allocation -- readme
add paging illustration -- readme

this sample pretends that each directory has only
2 table entries.
wip move docs
[wip] mmu experiments

[wip] extract mmu features printer

sq extract features

[❌almost PICKED] extract phys_frame code

[wip] extract virt_page code

drop obsolete stuff

Start moving code to a new mmu2 module

[wip] necessary modifications

[wip] add to-kernel-space/from-kernel-space address conversion

Implement comparison for invalid virt address error

Similar to PhysAddrNotValid.

Move PageSize to a mod and implement it for phys frames and virt pages

[fixme] move those out

[wip] Improve virt_page impl and add tests

[wip] memory map initialization

[wip] directory levels traversal -- mmu2

Make features printing compile

[sq] add missing Clone derives

[wip] reshuffle stuff around - to be finalized

[sq] use static_assertions

[sq] add missing documentation

Switch to usize for alignment checks

[sq] fix iterator checks

[sq] make error enum public

[temp] allow dead_code while this code is experimental and unused

wip improve mmu mapping code

wip mmu

wip -- mmu2

sq fix compilation -- mmu2

sq text -- mmu2, readme

[wip] memmap

[wip] Improve virt_page and virt_addr generic impls

Not very good size-wise yet. Probably manual impls for necessary types
will be better.

[wip] fix some virt_addr/virt_page tests

fix pagesize tests

Add default() free fn support

❌ adding ttt
@berkus berkus force-pushed the feat/kernel-api branch from 34541f4 to b5ae51e Compare March 5, 2026 11:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add kernel syscall API and ABI Explore: Add DTB parsing support

1 participant