File tree 2 files changed +3
-4
lines changed
2 files changed +3
-4
lines changed Original file line number Diff line number Diff line change @@ -21,7 +21,7 @@ impl UsedLevel4Entries {
21
21
let end_page: Page =
22
22
Page :: containing_address ( VirtAddr :: new ( segment. virtual_addr + segment. mem_size ) ) ;
23
23
24
- for p4_index in u64:: from ( start_page. p4_index ( ) ) ..u64:: from ( end_page. p4_index ( ) ) {
24
+ for p4_index in u64:: from ( start_page. p4_index ( ) ) ..= u64:: from ( end_page. p4_index ( ) ) {
25
25
used. entry_state [ p4_index as usize ] = true ;
26
26
}
27
27
}
Original file line number Diff line number Diff line change 1
1
use crate :: frame_allocator:: FrameAllocator ;
2
- use crate :: level4_entries:: UsedLevel4Entries ;
3
2
use bootloader:: bootinfo:: MemoryRegionType ;
4
3
use fixedvec:: FixedVec ;
5
4
use x86_64:: structures:: paging:: mapper:: { MapToError , MapperFlush , UnmapError } ;
@@ -22,13 +21,13 @@ pub(crate) fn map_kernel(
22
21
23
22
// Create a stack
24
23
let stack_size: u64 = 512 ; // in pages
24
+ let stack_start = stack_start + 1 ; // Leave the first page unmapped as a 'guard page'
25
25
let stack_end = stack_start + stack_size;
26
26
27
27
let flags = PageTableFlags :: PRESENT | PageTableFlags :: WRITABLE ;
28
28
let region_type = MemoryRegionType :: KernelStack ;
29
29
30
- // Leave the first page unmapped as a 'guard page'
31
- for page in Page :: range ( stack_start + 1 , stack_end) {
30
+ for page in Page :: range ( stack_start, stack_end) {
32
31
let frame = frame_allocator
33
32
. allocate_frame ( region_type)
34
33
. ok_or ( MapToError :: FrameAllocationFailed ) ?;
You can’t perform that action at this time.
0 commit comments