diff --git a/src/arch/x86_64/driver/vga.rs b/src/arch/x86_64/driver/vga.rs index 09ab3d2..828529f 100644 --- a/src/arch/x86_64/driver/vga.rs +++ b/src/arch/x86_64/driver/vga.rs @@ -2,9 +2,10 @@ use spin::Mutex; use core::ptr::Unique; use volatile::Volatile; use x86_64::instructions::port::{outw, outb}; +use consts::KERNEL_OFFSET; -pub const VGA_BUFFER: Unique = unsafe{ - Unique::new_unchecked(0xb8000 as *mut _) +pub const VGA_BUFFER: Unique = unsafe { + Unique::new_unchecked((KERNEL_OFFSET + 0xb8000) as *mut _) }; #[allow(dead_code)] diff --git a/src/memory/mod.rs b/src/memory/mod.rs index 1ec4ccc..b9cba32 100644 --- a/src/memory/mod.rs +++ b/src/memory/mod.rs @@ -81,8 +81,8 @@ pub fn remap_the_kernel(boot_info: BootInformation) -> Stack { let mut active_table = unsafe { ActivePageTable::new() }; let mut memory_set = MemorySet::from(boot_info.elf_sections_tag().unwrap()); - use consts::{KERNEL_HEAP_OFFSET, KERNEL_HEAP_SIZE}; - memory_set.push(MemoryArea::new_identity(0xb8000, 0xb9000, EntryFlags::WRITABLE, "VGA")); + use consts::{KERNEL_OFFSET, KERNEL_HEAP_OFFSET, KERNEL_HEAP_SIZE}; + memory_set.push(MemoryArea::new_kernel(KERNEL_OFFSET + 0xb8000, KERNEL_OFFSET + 0xb9000, EntryFlags::WRITABLE, "VGA")); memory_set.push(MemoryArea::new(KERNEL_HEAP_OFFSET, KERNEL_HEAP_OFFSET + KERNEL_HEAP_SIZE, EntryFlags::WRITABLE, "kernel_heap")); let mut page_table = InactivePageTable::new(alloc_frame(), &mut active_table);