-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* clean the tcb debug * add the map_kernel_devices of aarch64,but need fix the riscv64 * clean warnings and fmt * add the riscv64 map_kernel_devices
- Loading branch information
1 parent
86b93d6
commit 2f69158
Showing
7 changed files
with
139 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
use super::boot::map_kernel_frame; | ||
use crate::{paddr_t, pptr_t, vm_attributes_t}; | ||
use sel4_common::arch::vm_rights_t::VMKernelOnly; | ||
use sel4_common::{sel4_config::PAGE_BITS, BIT}; | ||
|
||
pub const KDEV_BASE: usize = 0xFFFFFFFFC0000000; | ||
pub(crate) const NUM_KERNEL_DEVICE_FRAMES: usize = 3; | ||
pub(crate) const UART_PPTR: usize = KDEV_BASE + 0x0; | ||
pub(crate) const GIC_V2_DISTRIBUTOR_PPTR: usize = KDEV_BASE + 0x1000; | ||
pub(crate) const GIC_V2_CONTROLLER_PPTR: usize = KDEV_BASE + 0x2000; | ||
#[derive(Copy, Clone)] | ||
struct kernel_frame_t { | ||
paddr: paddr_t, | ||
pptr: pptr_t, | ||
armExecuteNever: isize, | ||
userAvailable: isize, | ||
} | ||
|
||
#[derive(Copy, Clone)] | ||
#[repr(C)] | ||
struct p_region_t { | ||
pub start: usize, | ||
pub end: usize, | ||
} | ||
extern "C" { | ||
pub(self) fn reserve_region(reg: p_region_t) -> bool; | ||
} | ||
|
||
#[no_mangle] | ||
#[link_section = ".boot.text"] | ||
pub(self) static mut kernel_device_frames: [kernel_frame_t; NUM_KERNEL_DEVICE_FRAMES] = [ | ||
kernel_frame_t { | ||
paddr: paddr_t(0x9000000), | ||
pptr: UART_PPTR, | ||
armExecuteNever: 1, | ||
userAvailable: 1, | ||
}, | ||
kernel_frame_t { | ||
paddr: paddr_t(0x8000000), | ||
pptr: GIC_V2_DISTRIBUTOR_PPTR, | ||
armExecuteNever: 1, | ||
userAvailable: 0, | ||
}, | ||
kernel_frame_t { | ||
paddr: paddr_t(0x8010000), | ||
pptr: GIC_V2_CONTROLLER_PPTR, | ||
armExecuteNever: 1, | ||
userAvailable: 0, | ||
}, | ||
]; | ||
#[no_mangle] | ||
pub fn map_kernel_devices() { | ||
unsafe { | ||
for kernel_frame in kernel_device_frames { | ||
let vm_attr: vm_attributes_t = vm_attributes_t(kernel_frame.armExecuteNever as usize); | ||
map_kernel_frame( | ||
kernel_frame.paddr.0, | ||
kernel_frame.pptr, | ||
VMKernelOnly, | ||
vm_attr, | ||
); | ||
if kernel_frame.userAvailable == 0 { | ||
reserve_region(p_region_t { | ||
start: kernel_frame.paddr.0, | ||
end: kernel_frame.paddr.0 + BIT!(PAGE_BITS), | ||
}); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use super::boot::map_kernel_frame; | ||
use crate::{paddr_t, pptr_t}; | ||
use sel4_common::arch::vm_rights_t::VMKernelOnly; | ||
use sel4_common::{sel4_config::PAGE_BITS, BIT}; | ||
|
||
pub const KDEV_BASE: usize = 0xFFFFFFFFC0000000; | ||
pub(crate) const NUM_KERNEL_DEVICE_FRAMES: usize = 0; | ||
#[derive(Copy, Clone)] | ||
struct kernel_frame_t { | ||
paddr: paddr_t, | ||
pptr: pptr_t, | ||
userAvailable: isize, | ||
} | ||
|
||
#[derive(Copy, Clone)] | ||
#[repr(C)] | ||
struct p_region_t { | ||
pub start: usize, | ||
pub end: usize, | ||
} | ||
extern "C" { | ||
pub(self) fn reserve_region(reg: p_region_t) -> bool; | ||
} | ||
|
||
#[no_mangle] | ||
#[link_section = ".boot.text"] | ||
pub(self) static mut kernel_device_frames: [kernel_frame_t; NUM_KERNEL_DEVICE_FRAMES] = []; | ||
#[no_mangle] | ||
pub fn map_kernel_devices() { | ||
unsafe { | ||
for kernel_frame in kernel_device_frames { | ||
map_kernel_frame(kernel_frame.paddr.0, kernel_frame.pptr, VMKernelOnly); | ||
if kernel_frame.userAvailable == 0 { | ||
reserve_region(p_region_t { | ||
start: kernel_frame.paddr.0, | ||
end: kernel_frame.paddr.0 + BIT!(PAGE_BITS), | ||
}); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters