Skip to content

Commit 005155b

Browse files
authored
Merge pull request #23 from manchangfengxu/fix/doc-comments
fix(docs): Clarify alignment behavior and fix typo in map function
2 parents 582dc1e + 9049ac7 commit 005155b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

page_table_multiarch/src/bits64.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ impl<M: PagingMetaData, PTE: GenericPTE, H: PagingHandler> PageTable64<M, PTE, H
5454
/// Maps a virtual page to a physical frame with the given `page_size`
5555
/// and mapping `flags`.
5656
///
57-
/// The virtual page starts with `vaddr`, amd the physical frame starts with
58-
/// `target`. If the addresses is not aligned to the page size, they will be
57+
/// The virtual page starts with `vaddr`, and the physical frame starts with
58+
/// `target`. If the `target` is not aligned to the `page_size`, it will be
5959
/// aligned down automatically.
6060
///
6161
/// Returns [`Err(PagingError::AlreadyMapped)`](PagingError::AlreadyMapped)
@@ -67,6 +67,8 @@ impl<M: PagingMetaData, PTE: GenericPTE, H: PagingHandler> PageTable64<M, PTE, H
6767
page_size: PageSize,
6868
flags: MappingFlags,
6969
) -> PagingResult<TlbFlush<M>> {
70+
// `vaddr` does not need to be page-aligned here; `get_entry_mut_or_create`
71+
// internally maps `vaddr` to its corresponding page table entry (PTE).
7072
let entry = self.get_entry_mut_or_create(vaddr, page_size)?;
7173
if !entry.is_unused() {
7274
return Err(PagingError::AlreadyMapped);

0 commit comments

Comments
 (0)