Skip to content

Commit

Permalink
Merge pull request #4 from arceos-org/fix-present
Browse files Browse the repository at this point in the history
  • Loading branch information
equation314 authored Aug 9, 2024
2 parents 986e257 + d3134fe commit df614b5
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions page_table_multiarch/src/bits64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ impl<M: PagingMetaData, PTE: GenericPTE, H: PagingHandler> PageTable64<M, PTE, H
flags: MappingFlags,
) -> PagingResult<(PageSize, TlbFlush<M>)> {
let (entry, size) = self.get_entry_mut(vaddr)?;
if entry.is_unused() {
if !entry.is_present() {
return Err(PagingError::NotMapped);
}
entry.set_flags(flags, size.is_huge());
Expand All @@ -117,7 +117,8 @@ impl<M: PagingMetaData, PTE: GenericPTE, H: PagingHandler> PageTable64<M, PTE, H
/// mapping is not present.
pub fn unmap(&mut self, vaddr: M::VirtAddr) -> PagingResult<(PhysAddr, PageSize, TlbFlush<M>)> {
let (entry, size) = self.get_entry_mut(vaddr)?;
if entry.is_unused() {
if !entry.is_present() {
entry.clear();
return Err(PagingError::NotMapped);
}
let paddr = entry.paddr();
Expand Down

0 comments on commit df614b5

Please sign in to comment.