Skip to content

Conversation

@PKTH-Jx
Copy link

@PKTH-Jx PKTH-Jx commented Sep 23, 2025

Features

  • Replace the old page table implementation with Verus-verified version for aarch64 (src/arch/aarch64/paging.rs).
  • Add dependencies:
    • hvisor-pt: An arch-independent and formal-verified page table implementation.
    • vstd: Verus language support.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR replaces the existing page table implementation with a Verus-verified version for aarch64 architecture. The change improves code reliability by using formal verification while maintaining the same API interface.

  • Removes custom page table entry (PTE) implementation and related attribute handling
  • Integrates hvisor-pt library with Verus verification support
  • Updates page table operations to use the new verified implementation

Reviewed Changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
src/arch/aarch64/s2pt.rs Removes custom PageTableEntry and descriptor attribute implementations, simplifies type definition
src/arch/aarch64/paging.rs Replaces custom page table with Aarch64PageTable from hvisor-pt, adds Verus integration
Cargo.toml Adds dependencies for vstd and hvisor-pt libraries

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

spec fn view(self) -> PageTableMem {
PageTableMem {
tables: Seq::new(self.tables.len() as nat, |i| Table {
base: self.frames[i].start_paddr(),
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

Field access self.frames[i] should be self.tables[i] to match the struct field name defined on line 155.

Suggested change
base: self.frames[i].start_paddr(),
base: self.tables[i].start_paddr(),

Copilot uses AI. Check for mistakes.
Comment on lines +201 to +205
fn read(&self, base:PAddrExec, index:usize) -> u64 {
unsafe { (base.0 as *const u64).offset(index as isize).read_volatile() }
}

fn unmap_page(&mut self, vaddr: VA) -> PagingResult<(PhysAddr, PageSize)> {
let (entry, size) = self.inner.get_entry_mut(vaddr)?;
if entry.is_unused() {
return Err(PagingError::NotMapped);
}
let paddr = entry.addr();
entry.clear();
Ok((paddr, size))
fn write(&mut self, base:PAddrExec, index:usize, val:u64) {
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing spaces after colons in parameter declarations. Should be base: PAddrExec, index: usize for consistency with Rust formatting conventions.

Copilot uses AI. Check for mistakes.
Comment on lines +201 to +205
fn read(&self, base:PAddrExec, index:usize) -> u64 {
unsafe { (base.0 as *const u64).offset(index as isize).read_volatile() }
}

fn unmap_page(&mut self, vaddr: VA) -> PagingResult<(PhysAddr, PageSize)> {
let (entry, size) = self.inner.get_entry_mut(vaddr)?;
if entry.is_unused() {
return Err(PagingError::NotMapped);
}
let paddr = entry.addr();
entry.clear();
Ok((paddr, size))
fn write(&mut self, base:PAddrExec, index:usize, val:u64) {
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

[nitpick] Missing spaces after colons in parameter declarations. Should be base: PAddrExec, index: usize for consistency with Rust formatting conventions.

Copilot uses AI. Check for mistakes.
};
Self {
inner: HvPageTableUnlocked::new(level),
inner: Aarch64PageTable::new(arch, 0x0, 0x80000000),
Copy link

Copilot AI Sep 23, 2025

Choose a reason for hiding this comment

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

[nitpick] Magic numbers 0x0 and 0x80000000 should be defined as named constants to improve code readability and maintainability.

Copilot uses AI. Check for mistakes.
@PKTH-Jx PKTH-Jx closed this Sep 26, 2025
@PKTH-Jx PKTH-Jx deleted the verified-pt branch September 26, 2025 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants