Skip to content

Commit

Permalink
Move ops up from paging module for generalization.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nate Catelli committed Aug 19, 2021
1 parent 9144414 commit 137cdef
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
8 changes: 3 additions & 5 deletions src/addr.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
//! Physical and virtual addresses manipulation
use crate::ops::{CheckedAdd, CheckedSub};
use core::fmt;
use core::ops::{Add, AddAssign, Sub, SubAssign};

use crate::structures::paging::{
ops::{CheckedAdd, CheckedSub},
PageOffset, PageTableIndex,
};
use crate::structures::paging::{PageOffset, PageTableIndex};
use bit_field::BitField;

/// A canonical 64-bit virtual memory address.
Expand Down Expand Up @@ -586,7 +584,7 @@ impl Sub<PhysAddr> for PhysAddr {
/// the address is canonical or not.
#[inline]
const fn is_canonical(addr: u64) -> Option<u64> {
let msb = (addr & 0xffff800000000000) >> 47;
let msb = (addr >> 47) & 0x1ffff;

// The most-significant 17 bits must all be one or all be 0.
if msb == 0x0 || msb == 0x1ffff {
Expand Down
1 change: 1 addition & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ pub(crate) mod asm;

pub mod addr;
pub mod instructions;
pub mod ops;
pub mod registers;
pub mod structures;

Expand Down
File renamed without changes.
1 change: 0 additions & 1 deletion src/structures/paging/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ pub use self::page_table::{PageOffset, PageTable, PageTableFlags, PageTableIndex
pub mod frame;
mod frame_alloc;
pub mod mapper;
pub mod ops;
pub mod page;
pub mod page_table;

0 comments on commit 137cdef

Please sign in to comment.