Skip to main content

hyperlight_common/arch/aarch64/
vmem.rs

1/*
2Copyright 2025  The Hyperlight Authors.
3
4Licensed under the Apache License, Version 2.0 (the "License");
5you may not use this file except in compliance with the License.
6You may obtain a copy of the License at
7
8    http://www.apache.org/licenses/LICENSE-2.0
9
10Unless required by applicable law or agreed to in writing, software
11distributed under the License is distributed on an "AS IS" BASIS,
12WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13See the License for the specific language governing permissions and
14limitations under the License.
15 */
16
17// TODO(aarch64): implement real page table operations
18
19use crate::vmem::{Mapping, TableOps, TableReadOps, Void};
20
21pub const PAGE_SIZE: usize = 4096;
22pub const PAGE_TABLE_SIZE: usize = 4096;
23pub type PageTableEntry = u64;
24pub type VirtAddr = u64;
25pub type PhysAddr = u64;
26
27/// # Safety
28/// See `TableOps` documentation.
29#[allow(clippy::missing_safety_doc)]
30pub unsafe fn map<Op: TableOps>(_op: &Op, _mapping: Mapping) {
31    unimplemented!("map")
32}
33
34/// # Safety
35/// See `TableReadOps` documentation.
36#[allow(clippy::missing_safety_doc)]
37pub unsafe fn virt_to_phys<'a, Op: TableReadOps + 'a>(
38    _op: impl core::convert::AsRef<Op> + Copy + 'a,
39    _address: u64,
40    _len: u64,
41) -> impl Iterator<Item = Mapping> + 'a {
42    unimplemented!("virt_to_phys");
43    #[allow(unreachable_code)]
44    core::iter::empty()
45}
46
47pub trait TableMovability<Op: TableReadOps + ?Sized, TableMoveInfo> {}
48impl<Op: TableOps<TableMovability = crate::vmem::MayMoveTable>> TableMovability<Op, Op::TableAddr>
49    for crate::vmem::MayMoveTable
50{
51}
52impl<Op: TableReadOps> TableMovability<Op, Void> for crate::vmem::MayNotMoveTable {}