Skip to content

feat(arm): add ARM architecture support with context and trap handling - #16

Merged
equation314 merged 27 commits into
arceos-org:mainfrom
luodeb:main
Mar 22, 2026
Merged

feat(arm): add ARM architecture support with context and trap handling#16
equation314 merged 27 commits into
arceos-org:mainfrom
luodeb:main

Conversation

@luodeb

@luodeb luodeb commented Dec 6, 2025

Copy link
Copy Markdown
Contributor

Note: This code was generated by GPT and is currently being verified for correctness

@luodeb
luodeb marked this pull request as draft December 8, 2025 05:26
@equation314 equation314 moved this from Todo to In Progress in ARM32 support Dec 21, 2025
Comment thread src/arm/asm.rs
@luodeb
luodeb requested a review from equation314 December 25, 2025 07:09
@luodeb
luodeb marked this pull request as ready for review December 25, 2025 07:09
Comment thread src/arm/macros.rs Outdated
Comment thread src/arm/trap.S Outdated
Comment thread src/arm/trap.rs Outdated
Comment thread src/arm/trap.rs Outdated
Comment thread src/arm/trap.rs Outdated
Comment thread src/arm/trap.rs
Comment thread src/arm/trap.rs Outdated
Comment thread src/arm/asm.rs Outdated
Comment thread src/arm/asm.rs Outdated
Comment thread src/arm/asm.rs Outdated
Comment thread src/arm/context.rs Outdated
Comment thread src/arm/trap.rs
Comment thread src/arm/asm.rs Outdated
Comment thread src/arm/asm.rs Outdated
Comment thread src/arm/init.rs Outdated
Comment thread src/arm/init.rs Outdated
Comment thread src/arm/trap.rs

@equation314 equation314 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also add arm target to CI.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds initial ARM32 (target_arch = "arm") support to the crate by introducing architecture-specific context structures, CPU init/MMU helpers, and bare-metal trap/exception handling (Rust + vector table assembly).

Changes:

  • Wire up arm as a supported architecture in src/lib.rs.
  • Add src/arm/* implementing ARM32 context switching, low-level asm wrappers, MMU/trap init, and exception handlers.
  • Add an ARM-only dependency on aarch32-cpu (and lockfile updates).

Reviewed changes

Copilot reviewed 8 out of 9 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
src/lib.rs Selects arm module when compiling for target_arch = "arm".
src/arm/mod.rs Declares ARM32 submodules and re-exports key types/APIs.
src/arm/context.rs Defines ARM32 TrapFrame, TaskContext, and optional FP state handling.
src/arm/asm.rs Provides ARM32 assembly wrappers (MMU regs, barriers, IRQ control, caches, timers).
src/arm/init.rs Adds ARM32 MMU initialization and trap initialization (vector base + TTBR0).
src/arm/trap.rs Implements Rust-side exception decoding and trap dispatch to handle_trap!.
src/arm/trap.S Adds ARM32 vector table and exception entry/return sequences.
Cargo.toml Adds aarch32-cpu as an ARM-only dependency.
Cargo.lock Locks transitive dependencies introduced by aarch32-cpu.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/arm/trap.rs Outdated
Comment thread src/arm/trap.rs Outdated
Comment thread src/arm/init.rs Outdated
Comment thread src/arm/trap.S Outdated
Comment thread src/arm/trap.S Outdated
Comment thread src/arm/trap.rs Outdated
Comment thread src/arm/trap.rs
Comment thread Cargo.toml Outdated
Comment thread src/arm/asm.rs Outdated
Comment thread src/arm/asm.rs Outdated
Comment thread src/arm/init.rs Outdated
Comment thread src/arm/trap.rs Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/arm/trap.S Outdated
Comment thread src/arm/trap.S Outdated
Comment thread src/arm/trap.rs
Comment thread Cargo.toml
Comment thread src/arm/init.rs Outdated

@equation314 equation314 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please rebase to the latest main branch.

Comment thread src/arm/trap.S Outdated
Comment thread src/arm/trap.S Outdated
Comment thread src/arm/trap.S Outdated
Comment thread src/arm/trap.S Outdated
luodeb added 4 commits March 5, 2026 10:24
Replaces inline assembly calls for ARM operations with functions and register accessors from the aarch32-cpu crate, improving safety, readability, and maintainability. Adds aarch32-cpu as a conditional dependency for ARM targets.
Modernizes MMU init logic and documents register access for clarity.
Replaces raw inline assembly and custom barriers/TLB invalidation
with type-safe abstractions from the CPU crate. Improves
readability, correctness, and maintainability by relying on
well-tested interfaces for synchronization and control register
modification.
@luodeb
luodeb requested a review from equation314 March 5, 2026 04:24

@equation314 equation314 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix CI

Comment thread src/arm/asm.rs Outdated
Comment thread src/arm/asm.rs Outdated
@equation314
equation314 merged commit d2e30cc into arceos-org:main Mar 22, 2026
9 checks passed
@github-project-automation github-project-automation Bot moved this from In Progress to Done in ARM32 support Mar 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants