pvmfw: helpers: Represent addresses as usize
Use the more natural type to represent "pointers as integers".
Test: -
Change-Id: I9bedfb1aad80769f5b3beaf18e896226c09ba758
diff --git a/pvmfw/src/helpers.rs b/pvmfw/src/helpers.rs
index 781c1ac..bcace14 100644
--- a/pvmfw/src/helpers.rs
+++ b/pvmfw/src/helpers.rs
@@ -15,12 +15,12 @@
//! Miscellaneous helper functions.
/// Computes the address of the page containing a given address.
-pub const fn page_of(addr: u64, page_size: u64) -> u64 {
+pub const fn page_of(addr: usize, page_size: usize) -> usize {
addr & !(page_size - 1)
}
/// Validates a page size and computes the address of the page containing a given address.
-pub const fn checked_page_of(addr: u64, page_size: u64) -> Option<u64> {
+pub const fn checked_page_of(addr: usize, page_size: usize) -> Option<usize> {
if page_size.is_power_of_two() {
Some(page_of(addr, page_size))
} else {
@@ -29,8 +29,8 @@
}
/// Computes the address of the 4KiB page containing a given address.
-pub const fn page_4kb_of(addr: u64) -> u64 {
- const PAGE_SIZE: u64 = 4 << 10;
+pub const fn page_4kb_of(addr: usize) -> usize {
+ const PAGE_SIZE: usize = 4 << 10;
page_of(addr, PAGE_SIZE)
}