File tree Expand file tree Collapse file tree 1 file changed +2
-14
lines changed
src/aero_kernel/src/mem/paging Expand file tree Collapse file tree 1 file changed +2
-14
lines changed Original file line number Diff line number Diff line change @@ -118,20 +118,8 @@ impl VirtAddr {
118
118
119
119
/// Returns if the address is valid to read `sizeof(T)` bytes at the address.
120
120
fn validate_read < T : Sized > ( & self ) -> bool {
121
- ( * self + core:: mem:: size_of :: < T > ( ) ) <= crate :: arch:: task:: userland_last_address ( )
122
- }
123
-
124
- /// Validate reads `sizeof(T)` bytes from the virtual address and returns a copy
125
- /// of the value (`T`).
126
- ///
127
- /// ## Example
128
- /// ```no_run
129
- /// let value: u64 = VirtAddr::new(0xcafebabe)
130
- /// .copied_read::<u64>()
131
- /// .ok_or(AeroSyscallError::EFAULT)?;
132
- /// ```
133
- pub fn copied_read < T : Copy + Sized > ( & self ) -> Option < T > {
134
- self . read_mut :: < T > ( ) . map ( |t| * t)
121
+ ( * self + core:: mem:: size_of :: < T > ( ) ) <= crate :: arch:: task:: userland_last_address ( ) // in-range
122
+ && self . 0 != 0 // non-null
135
123
}
136
124
137
125
/// Aligns the virtual address downwards to the given alignment.
You can’t perform that action at this time.
0 commit comments