Skip to content

fix(hal): boot aarch64 to the serial console in QEMU virt - #140

Merged
kernalix7 merged 1 commit into
mainfrom
fix/aarch64-boot-bringup
Jul 10, 2026
Merged

fix(hal): boot aarch64 to the serial console in QEMU virt#140
kernalix7 merged 1 commit into
mainfrom
fix/aarch64-boot-bringup

Conversation

@kernalix7

Copy link
Copy Markdown
Owner

The aarch64 _start faulted before reaching Rust:

  1. It set SCTLR_EL1.M (MMU enable) without ever installing a TTBR0_EL1 translation table → the next instruction fetch took a level-1 translation abort (ESR 0x86000005, verified via qemu -d int).
  2. It never enabled FP/SIMD → the first NEON instruction from Rust codegen (memcpy/formatting) trapped (ESR EC=0x07) and spun in the stub vector table.

Fix both in the boot stub: defer the MMU (flat physical addressing until an identity page table is built — enough for console + init) and set CPACR_EL1.FPEN=0b11 before kernel_main.

Verifiedqemu-system-aarch64 -M virt -cpu cortex-a72 -kernel … now prints:

[ONCRIX/aarch64] Kernel booting...
[ONCRIX/aarch64] PL011 UART initialized (115200 8N1)
[ONCRIX/aarch64] Heap initialized (16 MiB)

First actual runtime execution of the cross-arch kernel. x86_64 unaffected (aarch64-only boot stub).

The aarch64 _start faulted before reaching Rust: (1) it set SCTLR_EL1.M
to enable the MMU without ever installing a TTBR0_EL1 translation table,
so the next instruction fetch took a level-1 translation abort; (2) it
never enabled FP/SIMD, so the first NEON instruction emitted by Rust
codegen (memcpy/formatting) trapped with ESR EC=0x07 and spun in the
stub vector table.

Fix both in the boot stub: defer the MMU (run with flat physical
addressing until an identity page table is built — sufficient for the
console + init path) and set CPACR_EL1.FPEN=0b11 before calling
kernel_main. The aarch64 kernel now boots in 'qemu-system-aarch64 -M
virt' and prints:
  [ONCRIX/aarch64] Kernel booting...
  [ONCRIX/aarch64] PL011 UART initialized (115200 8N1)
  [ONCRIX/aarch64] Heap initialized (16 MiB)
x86_64 is unaffected (aarch64-only boot stub).
@kernalix7
kernalix7 merged commit 2031c4a into main Jul 10, 2026
2 checks passed
@kernalix7
kernalix7 deleted the fix/aarch64-boot-bringup branch July 10, 2026 07:51
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.

1 participant