parent
1140d32aaa
commit
174e0da3b6
@ -0,0 +1,5 @@
|
||||
//! Raspberry PI 3 Model B/B+
|
||||
|
||||
pub fn init() {
|
||||
// TODO
|
||||
}
|
@ -0,0 +1,62 @@
|
||||
//! Trapframe and context definitions for aarch64.
|
||||
|
||||
/// TODO
|
||||
#[repr(C)]
|
||||
#[derive(Debug)]
|
||||
pub struct TrapFrame {
|
||||
// TODO
|
||||
}
|
||||
|
||||
///TODO
|
||||
#[derive(Debug)]
|
||||
pub struct Context {
|
||||
// TODO
|
||||
}
|
||||
|
||||
impl Context {
|
||||
/// TODO
|
||||
#[inline(never)]
|
||||
pub unsafe extern fn switch(&mut self, target: &mut Self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// TODO
|
||||
pub unsafe fn null() -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// TODO
|
||||
pub unsafe fn new_kernel_thread(entry: extern fn(usize) -> !, arg: usize, kstack_top: usize, cr3: usize) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// TODO
|
||||
pub unsafe fn new_user_thread(entry_addr: usize, ustack_top: usize, kstack_top: usize, is32: bool, cr3: usize) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// TODO
|
||||
pub unsafe fn new_fork(tf: &TrapFrame, kstack_top: usize, cr3: usize) -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn enable() {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn disable() {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn disable_and_store() -> usize {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
#[inline(always)]
|
||||
pub unsafe fn restore(flags: usize) {
|
||||
unimplemented!()
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
//! Interrupt handler implementation on raspi3.
|
||||
|
||||
pub use self::context::*;
|
||||
|
||||
#[path = "context.rs"]
|
||||
mod context;
|
||||
|
||||
/// Initialize the trap to enable the interrupt.
|
||||
pub fn init() {
|
||||
// TODO
|
||||
// info!("interrupt: init end");
|
||||
}
|
||||
|
||||
/// Enable the interrupt.
|
||||
#[inline(always)]
|
||||
pub unsafe fn enable() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
/// Disable the interrupt.
|
||||
#[inline(always)]
|
||||
pub unsafe fn disable() {
|
||||
// TODO
|
||||
}
|
||||
|
||||
/// Disable the interrupt and store the status.
|
||||
///
|
||||
/// return: status(usize)
|
||||
#[inline(always)]
|
||||
pub unsafe fn disable_and_store() -> usize {
|
||||
// TODO
|
||||
0
|
||||
}
|
||||
|
||||
/// Use the original status to restore the process
|
||||
///
|
||||
/// Arguments:
|
||||
/// * flags: original status(usize)
|
||||
#[inline(always)]
|
||||
pub unsafe fn restore(flags: usize) {
|
||||
// TODO
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
//! Serial driver for aarch64.
|
||||
|
||||
use core::fmt::{Arguments};
|
||||
|
||||
/// TODO
|
||||
pub fn getchar() -> char {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// TODO
|
||||
pub fn putfmt(fmt: Arguments<'_>) {
|
||||
unimplemented!()
|
||||
}
|
@ -0,0 +1,8 @@
|
||||
//! Memory initialization for aarch64.
|
||||
|
||||
use ucore_memory::PAGE_SIZE;
|
||||
|
||||
/// Memory initialization.
|
||||
pub fn init() {
|
||||
// TODO
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
//! Entrance and initialization for aarch64.
|
||||
|
||||
pub mod io;
|
||||
pub mod paging;
|
||||
pub mod memory;
|
||||
pub mod interrupt;
|
||||
|
||||
#[cfg(feature = "board_raspi3")]
|
||||
#[path = "board/raspi3/mod.rs"]
|
||||
pub mod board;
|
||||
|
||||
/// TODO
|
||||
/// The entry point of kernel
|
||||
#[no_mangle] // don't mangle the name of this function
|
||||
pub extern fn rust_main() -> ! {
|
||||
println!("Hello ARM64!");
|
||||
|
||||
// First init log mod, so that we can print log info.
|
||||
// ::logging::init();
|
||||
// Init trap handling.
|
||||
// interrupt::init();
|
||||
// Init physical memory management and heap.
|
||||
// memory::init();
|
||||
// Now heap is available
|
||||
// timer::init();
|
||||
|
||||
// Init board.
|
||||
board::init();
|
||||
::kmain();
|
||||
}
|
||||
|
||||
// global_asm!(include_str!("boot/boot.asm"));
|
||||
// global_asm!(include_str!("boot/entry.asm"));
|
||||
// global_asm!(include_str!("boot/trap.asm"));
|
@ -0,0 +1,199 @@
|
||||
//! Page table implementations for aarch64.
|
||||
|
||||
use ucore_memory::memory_set::*;
|
||||
use ucore_memory::paging::*;
|
||||
|
||||
type VirtAddr = usize;
|
||||
type PhysAddr = usize;
|
||||
|
||||
/// TODO
|
||||
pub struct ActivePageTable {
|
||||
// TODO
|
||||
}
|
||||
|
||||
impl ActivePageTable {
|
||||
/// TODO
|
||||
pub unsafe fn new() -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
impl PageTable for ActivePageTable {
|
||||
type Entry = PageEntry;
|
||||
|
||||
fn map(&mut self, addr: VirtAddr, target: PhysAddr) -> &mut Self::Entry {
|
||||
unimplemented!()
|
||||
}
|
||||
fn unmap(&mut self, addr: VirtAddr) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn get_entry(&mut self, addr: VirtAddr) -> &mut Self::Entry {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
// For testing with mock
|
||||
fn get_page_slice_mut<'a,'b>(&'a mut self, addr: VirtAddr) -> &'b mut [u8] {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn read(&mut self, addr: VirtAddr) -> u8 {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn write(&mut self, addr: VirtAddr, data: u8) {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
||||
|
||||
/// TODO
|
||||
pub struct PageEntry {
|
||||
// TODO
|
||||
}
|
||||
|
||||
impl Entry for PageEntry {
|
||||
/// IMPORTANT!
|
||||
/// This must be called after any change to ensure it become effective.
|
||||
/// Usually this will make a flush to TLB/MMU.
|
||||
fn update(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Will be set when accessed
|
||||
fn accessed(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Will be set when written
|
||||
fn dirty(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Will PageFault when try to write page where writable=0
|
||||
fn writable(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
/// Will PageFault when try to access page where present=0
|
||||
fn present(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
|
||||
fn clear_accessed(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn clear_dirty(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_writable(&mut self, value: bool) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_present(&mut self, value: bool) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
|
||||
fn target(&self) -> PhysAddr {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_target(&mut self, target: PhysAddr) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
|
||||
// For Copy-on-write extension
|
||||
fn writable_shared(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn readonly_shared(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_shared(&mut self, writable: bool) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn clear_shared(&mut self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
|
||||
// For Swap extension
|
||||
fn swapped(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_swapped(&mut self, value: bool) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
|
||||
fn user(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_user(&mut self, value: bool) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn execute(&self) -> bool {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn set_execute(&mut self, value: bool) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// TODO
|
||||
pub struct InactivePageTable0 {
|
||||
// TODO
|
||||
}
|
||||
|
||||
/// TODO
|
||||
impl InactivePageTable for InactivePageTable0 {
|
||||
type Active = ActivePageTable;
|
||||
|
||||
fn new() -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn new_bare() -> Self {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn edit(&mut self, f: impl FnOnce(&mut Self::Active)) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
unsafe fn activate(&self) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
unsafe fn with(&self, f: impl FnOnce()) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn token(&self) -> usize {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn alloc_frame() -> Option<PhysAddr> {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn dealloc_frame(target: PhysAddr) {
|
||||
unimplemented!()
|
||||
}
|
||||
|
||||
fn alloc_stack() -> Stack {
|
||||
unimplemented!()
|
||||
}
|
||||
}
|
Loading…
Reference in new issue