Remove devmap region from aarch64, use physmap instead
This commit is contained in:
@@ -28,11 +28,8 @@
|
||||
/// Size of kernel heap
|
||||
pub const KERNEL_HEAP_SIZE: usize = 1 * 1024 * 1024; // 1 MB
|
||||
|
||||
/// Offset of device map region
|
||||
pub const KERNEL_DEVMAP_OFFSET: usize = KERNEL_HEAP_OFFSET - PML4_SIZE;
|
||||
|
||||
/// Offset of environment region
|
||||
pub const KERNEL_ENV_OFFSET: usize = KERNEL_DEVMAP_OFFSET - PML4_SIZE;
|
||||
pub const KERNEL_ENV_OFFSET: usize = KERNEL_HEAP_OFFSET - PML4_SIZE;
|
||||
|
||||
/// Offset of temporary mapping for misc kernel bring-up actions
|
||||
pub const KERNEL_TMP_MISC_OFFSET: usize = KERNEL_ENV_OFFSET - PML4_SIZE;
|
||||
|
||||
@@ -61,7 +61,7 @@ impl GicDistIf {
|
||||
let start_frame = Frame::containing_address(PhysicalAddress::new(0x08000000));
|
||||
let end_frame = Frame::containing_address(PhysicalAddress::new(0x08000000 + 0x10000 - 1));
|
||||
for frame in Frame::range_inclusive(start_frame, end_frame) {
|
||||
let page = Page::containing_address(VirtualAddress::new(frame.start_address().data() + crate::KERNEL_DEVMAP_OFFSET));
|
||||
let page = Page::containing_address(VirtualAddress::new(frame.start_address().data() + crate::PHYS_OFFSET));
|
||||
mapper
|
||||
.get_mut()
|
||||
.expect("failed to access KernelMapper for mapping GIC distributor")
|
||||
@@ -70,13 +70,13 @@ impl GicDistIf {
|
||||
.flush();
|
||||
}
|
||||
|
||||
self.address = crate::KERNEL_DEVMAP_OFFSET + 0x08000000;
|
||||
self.address = crate::PHYS_OFFSET + 0x08000000;
|
||||
|
||||
// Map in CPU0's interface
|
||||
let start_frame = Frame::containing_address(PhysicalAddress::new(0x08010000));
|
||||
let end_frame = Frame::containing_address(PhysicalAddress::new(0x08010000 + 0x10000 - 1));
|
||||
for frame in Frame::range_inclusive(start_frame, end_frame) {
|
||||
let page = Page::containing_address(VirtualAddress::new(frame.start_address().data() + crate::KERNEL_DEVMAP_OFFSET));
|
||||
let page = Page::containing_address(VirtualAddress::new(frame.start_address().data() + crate::PHYS_OFFSET));
|
||||
mapper
|
||||
.get_mut()
|
||||
.expect("failed to access KernelMapper for mapping GIC interface")
|
||||
@@ -85,7 +85,7 @@ impl GicDistIf {
|
||||
.flush();
|
||||
}
|
||||
|
||||
GIC_CPU_IF.address = crate::KERNEL_DEVMAP_OFFSET + 0x08010000;
|
||||
GIC_CPU_IF.address = crate::PHYS_OFFSET + 0x08010000;
|
||||
|
||||
// Disable IRQ Distribution
|
||||
self.write(GICD_CTLR, 0);
|
||||
|
||||
@@ -34,7 +34,7 @@ impl Pl031rtc {
|
||||
let end_frame = Frame::containing_address(PhysicalAddress::new(0x09010000 + 0x1000 - 1));
|
||||
|
||||
for frame in Frame::range_inclusive(start_frame, end_frame) {
|
||||
let page = Page::containing_address(VirtualAddress::new(frame.start_address().data() + crate::KERNEL_DEVMAP_OFFSET));
|
||||
let page = Page::containing_address(VirtualAddress::new(frame.start_address().data() + crate::PHYS_OFFSET));
|
||||
mapper
|
||||
.get_mut()
|
||||
.expect("failed to access KernelMapper for mapping RTC")
|
||||
@@ -43,7 +43,7 @@ impl Pl031rtc {
|
||||
.flush();
|
||||
}
|
||||
|
||||
self.address = crate::KERNEL_DEVMAP_OFFSET + 0x09010000;
|
||||
self.address = crate::PHYS_OFFSET + 0x09010000;
|
||||
}
|
||||
|
||||
unsafe fn read(&self, reg: u32) -> u32 {
|
||||
|
||||
@@ -16,7 +16,7 @@ pub unsafe fn init_early(dtb_base: usize, dtb_size: usize) {
|
||||
}
|
||||
|
||||
if let Some((phys, size)) = device_tree::diag_uart_range(dtb_base, dtb_size) {
|
||||
let virt = crate::KERNEL_DEVMAP_OFFSET + phys;
|
||||
let virt = crate::PHYS_OFFSET + phys;
|
||||
{
|
||||
let mut serial_port = SerialPort::new(virt);
|
||||
serial_port.init(false);
|
||||
|
||||
@@ -164,7 +164,7 @@ unsafe fn inner<A: Arch>(
|
||||
Some(serial_base) => {
|
||||
let flush = mapper.map_phys(
|
||||
VirtualAddress::new(serial_base),
|
||||
PhysicalAddress::new(serial_base - crate::KERNEL_DEVMAP_OFFSET),
|
||||
PhysicalAddress::new(serial_base - crate::PHYS_OFFSET),
|
||||
PageFlags::new().write(true)
|
||||
).expect("failed to map frame");
|
||||
flush.ignore(); // Not the active table
|
||||
|
||||
@@ -81,7 +81,7 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
|
||||
KERNEL_SIZE.store(kernel_size, Ordering::SeqCst);
|
||||
|
||||
// Try to find serial port prior to logging
|
||||
device::serial::init_early(crate::KERNEL_DEVMAP_OFFSET + dtb_base, dtb_size);
|
||||
device::serial::init_early(crate::PHYS_OFFSET + dtb_base, dtb_size);
|
||||
|
||||
// Convert env to slice
|
||||
let env = slice::from_raw_parts((args.env_base + crate::PHYS_OFFSET) as *const u8, args.env_size);
|
||||
@@ -112,11 +112,11 @@ pub unsafe extern fn kstart(args_ptr: *const KernelArgs) -> ! {
|
||||
info!("Bootstrap entry point: {:X}", args.bootstrap_entry);
|
||||
|
||||
println!("FILL MEMORY MAP START");
|
||||
device_tree::fill_memory_map(crate::KERNEL_DEVMAP_OFFSET + dtb_base, dtb_size);
|
||||
device_tree::fill_memory_map(crate::PHYS_OFFSET + dtb_base, dtb_size);
|
||||
println!("FILL MEMORY MAP COMPLETE");
|
||||
|
||||
println!("FILL ENV DATA START");
|
||||
let env_size = device_tree::fill_env_data(crate::KERNEL_DEVMAP_OFFSET + dtb_base, dtb_size, env_base);
|
||||
let env_size = device_tree::fill_env_data(crate::PHYS_OFFSET + dtb_base, dtb_size, env_base);
|
||||
println!("FILL ENV DATA COMPLETE");
|
||||
|
||||
// Initialize RMM
|
||||
|
||||
Reference in New Issue
Block a user