Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

klee: Fix self's usage where its reference is implied #252

Merged
merged 1 commit into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions rmm/src/realm/mm/stage2_tte.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl S2TTE {
Ok((S2TTE::from(s2tte as usize), last_level))
}

pub fn is_valid(self, level: usize, is_ns: bool) -> bool {
pub fn is_valid(&self, level: usize, is_ns: bool) -> bool {
let ns = self.get_masked_value(S2TTE::NS);
let ns_valid = if is_ns { ns == 1 } else { ns == 0 };
ns_valid
Expand All @@ -105,7 +105,7 @@ impl S2TTE {
&& self.get_masked_value(S2TTE::DESC_TYPE) == desc_type::L012_BLOCK))
}

pub fn is_host_ns_valid(self, level: usize) -> bool {
pub fn is_host_ns_valid(&self, level: usize) -> bool {
let tmp = S2TTE::new(!0);
let addr_mask = match level {
1 => tmp.get_masked(S2TTE::ADDR_L1_PAGE),
Expand Down Expand Up @@ -133,33 +133,33 @@ impl S2TTE {
return true;
}

pub fn is_unassigned(self) -> bool {
pub fn is_unassigned(&self) -> bool {
self.get_masked_value(S2TTE::DESC_TYPE) == desc_type::LX_INVALID
&& self.get_masked_value(S2TTE::INVALID_HIPAS) == invalid_hipas::UNASSIGNED
}

pub fn is_destroyed(self) -> bool {
pub fn is_destroyed(&self) -> bool {
self.get_masked_value(S2TTE::DESC_TYPE) == desc_type::LX_INVALID
&& self.get_masked_value(S2TTE::INVALID_HIPAS) == invalid_hipas::DESTROYED
}

pub fn is_assigned(self) -> bool {
pub fn is_assigned(&self) -> bool {
self.get_masked_value(S2TTE::DESC_TYPE) == desc_type::LX_INVALID
&& self.get_masked_value(S2TTE::INVALID_HIPAS) == invalid_hipas::ASSIGNED
}

// level should be the value returned in page table walking
// (== the last level that has been reached)
pub fn is_table(self, level: usize) -> bool {
pub fn is_table(&self, level: usize) -> bool {
(level < RTT_PAGE_LEVEL) && self.get_masked_value(S2TTE::DESC_TYPE) == desc_type::L012_TABLE
}

pub fn is_invalid_ripas(self) -> bool {
pub fn is_invalid_ripas(&self) -> bool {
(self.get_masked_value(S2TTE::DESC_TYPE) != desc_type::LX_INVALID)
&& (self.get_ripas() != invalid_ripas::RAM)
}

pub fn address(self, level: usize) -> Option<PhysAddr> {
pub fn address(&self, level: usize) -> Option<PhysAddr> {
match level {
1 => Some(PhysAddr::from(self.get_masked(S2TTE::ADDR_L1_PAGE))),
2 => Some(PhysAddr::from(self.get_masked(S2TTE::ADDR_L2_PAGE))),
Expand All @@ -168,7 +168,7 @@ impl S2TTE {
}
}

pub fn get_ripas(self) -> u64 {
pub fn get_ripas(&self) -> u64 {
self.get_masked_value(S2TTE::INVALID_RIPAS)
}
}
2 changes: 1 addition & 1 deletion rmm/src/rmi/rec/mpidr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ impl From<u64> for MPIDR {

impl MPIDR {
// B2.30 RecIndex function
pub fn index(self) -> usize {
pub fn index(&self) -> usize {
let aff0 = self.get_masked_value(MPIDR::AFF0) as usize;
let aff1 = self.get_masked_value(MPIDR::AFF1) as usize;
let aff2 = self.get_masked_value(MPIDR::AFF2) as usize;
Expand Down
Loading