1
0
mirror of https://github.com/sgmarz/osblog.git synced 2024-11-24 02:16:19 +04:00

Make id_map_range easier to read

This commit is contained in:
Stephen Marz 2019-10-09 21:36:54 -04:00
parent 5928b07621
commit deb5c972c2

View File

@ -97,11 +97,12 @@ pub fn id_map_range(root: &mut page::Table,
end: usize, end: usize,
bits: i64) bits: i64)
{ {
let start_aligned = start & !(page::PAGE_SIZE - 1);
let num_pages = (page::align_val(end, 12) let num_pages = (page::align_val(end, 12)
- (start & !(page::PAGE_SIZE - 1))) - start_aligned)
/ page::PAGE_SIZE; / page::PAGE_SIZE;
for i in 0..num_pages { for i in 0..num_pages {
let m = (start & !(page::PAGE_SIZE - 1)) + (i << 12); let m = start_aligned + (i << 12);
page::map(root, m, m, bits); page::map(root, m, m, bits);
} }
} }