Prepare for higher half
This commit is contained in:
parent
59327eb1b2
commit
729c7fd004
3 changed files with 10 additions and 2 deletions
|
@ -1,6 +1,7 @@
|
|||
ENTRY(kstart)
|
||||
OUTPUT_FORMAT(elf64-x86-64)
|
||||
|
||||
/* KERNEL_OFFSET = 0xfffffe8000100000; */
|
||||
KERNEL_OFFSET = 0x100000;
|
||||
|
||||
SECTIONS {
|
||||
|
|
|
@ -21,6 +21,9 @@ pub const ENTRY_COUNT: usize = 512;
|
|||
/// Size of pages
|
||||
pub const PAGE_SIZE: usize = 4096;
|
||||
|
||||
/// Offset of kernel from physical
|
||||
pub const KERNEL_OFFSET: usize = 0xfffffe8000000000;
|
||||
|
||||
/// Initialize paging
|
||||
pub unsafe fn init(stack_start: usize, stack_end: usize) -> ActivePageTable {
|
||||
extern {
|
||||
|
@ -66,7 +69,10 @@ pub unsafe fn init(stack_start: usize, stack_end: usize) -> ActivePageTable {
|
|||
let start_frame = Frame::containing_address(PhysicalAddress::new(start));
|
||||
let end_frame = Frame::containing_address(PhysicalAddress::new(end - 1));
|
||||
for frame in Frame::range_inclusive(start_frame, end_frame) {
|
||||
mapper.identity_map(frame, flags);
|
||||
mapper.identity_map(frame.clone(), flags);
|
||||
|
||||
let page = Page::containing_address(VirtualAddress::new(frame.start_address().get() + KERNEL_OFFSET));
|
||||
mapper.map_to(page, frame, flags);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue