fix memory area alignment
@@ -56,7 +56,9 @@ impl MemoryArea {
}
/// Check the array is within the readable memory
fn check_read_array<S>(&self, ptr: *const S, count: usize) -> bool {
- ptr as usize >= self.start_addr && unsafe { ptr.add(count) as usize } <= self.end_addr
+ // page align
+ ptr as usize >= Page::of_addr(self.start_addr).start_address()
+ && unsafe { ptr.add(count) as usize } < Page::of_addr(self.end_addr + PAGE_SIZE - 1).start_address()
}
/// Check the array is within the writable memory
fn check_write_array<S>(&self, ptr: *mut S, count: usize) -> bool {
