From 458347c1c0ca1e2a1716662cca5faaf371b04fd8 Mon Sep 17 00:00:00 2001 From: Jiajie Chen Date: Sun, 21 Jun 2020 15:54:15 +0800 Subject: [PATCH] Fix aarch64 compilation --- kernel/Cargo.lock | 9 +- kernel/Cargo.toml | 4 +- kernel/src/arch/aarch64/board/raspi3/emmc.rs | 1 - kernel/src/arch/aarch64/board/raspi3/irq.rs | 2 +- .../src/arch/aarch64/board/raspi3/serial.rs | 2 +- kernel/src/arch/aarch64/boot/entry.S | 10 +- kernel/src/arch/aarch64/interrupt/consts.rs | 8 + kernel/src/arch/aarch64/interrupt/context.rs | 246 ------------------ kernel/src/arch/aarch64/interrupt/handler.rs | 21 +- kernel/src/arch/aarch64/interrupt/mod.rs | 23 +- kernel/src/arch/aarch64/interrupt/trap.S | 103 -------- kernel/src/arch/aarch64/interrupt/vector.S | 29 --- kernel/src/arch/aarch64/memory.rs | 9 + kernel/src/arch/aarch64/mod.rs | 4 +- kernel/src/arch/aarch64/signal.rs | 2 +- kernel/src/arch/aarch64/timer.rs | 5 + 16 files changed, 72 insertions(+), 406 deletions(-) create mode 100644 kernel/src/arch/aarch64/interrupt/consts.rs delete mode 100644 kernel/src/arch/aarch64/interrupt/context.rs delete mode 100644 kernel/src/arch/aarch64/interrupt/trap.S delete mode 100644 kernel/src/arch/aarch64/interrupt/vector.S diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index fdebbc0b..83b9ae30 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -186,8 +186,9 @@ dependencies = [ [[package]] name = "executor" version = "0.6.0" -source = "git+https://github.com/rcore-os/executor.git?rev=662d3de#662d3ded46d53c4b6d144335719c50fc0adb2221" +source = "git+https://github.com/rcore-os/executor.git?rev=b8af982#b8af982dfe918e25fac303573c5f28dbf061fcb0" dependencies = [ + "aarch64", "executor-macros", "lazy_static", "riscv 0.5.6 (git+https://github.com/rcore-os/riscv?rev=d9794e)", @@ -199,7 +200,7 @@ dependencies = [ [[package]] name = "executor-macros" version = "0.0.1" -source = "git+https://github.com/rcore-os/executor.git?rev=662d3de#662d3ded46d53c4b6d144335719c50fc0adb2221" +source = "git+https://github.com/rcore-os/executor.git?rev=b8af982#b8af982dfe918e25fac303573c5f28dbf061fcb0" dependencies = [ "proc-macro2", "quote", @@ -722,9 +723,9 @@ checksum = "3a385d94f3f62e60445a0adb9ff8d9621faa272234530d4c0f848ec98f88e316" [[package]] name = "trapframe" version = "0.3.0" -source = "git+https://github.com/rcore-os/trapframe-rs?rev=9bf833f#9bf833fcf6a31a9e411f42e4ca1432cba9afe8f5" +source = "git+https://github.com/rcore-os/trapframe-rs?rev=9fbb557#9fbb557f97bbc52975d7b1510ac180f60c5d7ab1" dependencies = [ - "log", + "aarch64", "raw-cpuid", "riscv 0.5.6 (git+https://github.com/rcore-os/riscv?rev=d9794e)", "x86_64", diff --git a/kernel/Cargo.toml b/kernel/Cargo.toml index 33e38fcc..6d09f19e 100644 --- a/kernel/Cargo.toml +++ b/kernel/Cargo.toml @@ -54,7 +54,7 @@ bit_field = "0.10" buddy_system_allocator = "0.4.0" compression = { version = "0.1.4", default-features = false, features = ["gzip"] } device_tree = { git = "https://github.com/rcore-os/device_tree-rs", rev = "2fa8411c" } -executor = { git = "https://github.com/rcore-os/executor.git", rev = "662d3de" } +executor = { git = "https://github.com/rcore-os/executor.git", rev = "b8af982" } isomorphic_drivers = { git = "https://github.com/rcore-os/isomorphic_drivers", rev = "fcf694d2", features = ["log"] } lazy_static = { version = "1.4", features = ["spin_no_std"] } log = "0.4" @@ -74,7 +74,7 @@ rcore-fs-devfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "517af47" rlibc = "1.0" smoltcp = { git = "https://github.com/rcore-os/smoltcp", rev = "5bd87c7c", default-features = false, features = ["alloc", "log", "ethernet", "proto-ipv4", "proto-igmp", "socket-icmp", "socket-udp", "socket-tcp", "socket-raw"] } spin = "0.5" -trapframe = { git = "https://github.com/rcore-os/trapframe-rs", rev = "9bf833f" } +trapframe = { git = "https://github.com/rcore-os/trapframe-rs", rev = "9fbb557" } virtio-drivers = { git = "https://github.com/rcore-os/virtio-drivers", rev = "dfa70e14" } volatile = "0.2" woke = "0.0.2" diff --git a/kernel/src/arch/aarch64/board/raspi3/emmc.rs b/kernel/src/arch/aarch64/board/raspi3/emmc.rs index 34a4b919..77d63990 100644 --- a/kernel/src/arch/aarch64/board/raspi3/emmc.rs +++ b/kernel/src/arch/aarch64/board/raspi3/emmc.rs @@ -9,7 +9,6 @@ use super::mailbox; use crate::sync::SpinNoIrqLock as Mutex; -use crate::thread; use bcm2837::emmc::*; use core::mem; use core::slice; diff --git a/kernel/src/arch/aarch64/board/raspi3/irq.rs b/kernel/src/arch/aarch64/board/raspi3/irq.rs index bdc83483..f373a1d1 100644 --- a/kernel/src/arch/aarch64/board/raspi3/irq.rs +++ b/kernel/src/arch/aarch64/board/raspi3/irq.rs @@ -1,6 +1,6 @@ -use crate::arch::interrupt::TrapFrame; use bcm2837::interrupt::Controller; use spin::RwLock; +use trapframe::TrapFrame; pub use bcm2837::interrupt::Interrupt; diff --git a/kernel/src/arch/aarch64/board/raspi3/serial.rs b/kernel/src/arch/aarch64/board/raspi3/serial.rs index 3a77dc19..ceddbec6 100644 --- a/kernel/src/arch/aarch64/board/raspi3/serial.rs +++ b/kernel/src/arch/aarch64/board/raspi3/serial.rs @@ -74,7 +74,7 @@ impl fmt::Write for SerialPort { fn handle_serial_irq() { let serial = SERIAL_PORT.lock(); if serial.interrupt_is_pending(MiniUartInterruptId::Recive) { - crate::trap::serial(serial.read_byte() as char) + crate::trap::serial(serial.read_byte() as u8) } } diff --git a/kernel/src/arch/aarch64/boot/entry.S b/kernel/src/arch/aarch64/boot/entry.S index 2112177d..9a710d91 100644 --- a/kernel/src/arch/aarch64/boot/entry.S +++ b/kernel/src/arch/aarch64/boot/entry.S @@ -9,7 +9,9 @@ _start: # read cpu affinity, start core 0, halt rest mrs x19, mpidr_el1 and x19, x19, #3 + # compare and branch if non zero cbnz x19, halt + bl el_setup bl clear_bss bl create_init_paging @@ -43,7 +45,7 @@ switch_to_el2: mov x0, #0x3c9 msr spsr_el3, x0 - # switch + # switch to EL2 adr x0, switch_to_el1 msr elr_el3, x0 eret @@ -54,6 +56,7 @@ switch_to_el1: # at EL2 # set the temporary stack for EL1 in lower VA range + # x19 is cpu id adrp x0, _start sub x0, x0, x19, lsl #16 msr sp_el1, x0 @@ -87,11 +90,12 @@ switch_to_el1: msr cnthctl_el2, x0 msr cntvoff_el2, xzr - # switch + # switch to EL1 msr elr_el2, lr eret el_setup_end: # at EL1 + # x19 is cpu id adrp x0, _start sub x0, x0, x19, lsl #16 mov sp, x0 @@ -119,6 +123,8 @@ slave_startup: jump_to_main: msr ttbr0_el1, xzr ldr x8, =bootstacktop + + # x19 is cpu id sub x8, x8, x19, lsl #18 mov sp, x8 mov x29, xzr diff --git a/kernel/src/arch/aarch64/interrupt/consts.rs b/kernel/src/arch/aarch64/interrupt/consts.rs new file mode 100644 index 00000000..435ce366 --- /dev/null +++ b/kernel/src/arch/aarch64/interrupt/consts.rs @@ -0,0 +1,8 @@ +pub fn is_page_fault(trap: usize) -> bool { + false +} + +pub const IrqMax: usize = 0; +pub const IrqMin: usize = 0; +pub const Syscall: usize = 0; +pub const Timer: usize = 0; diff --git a/kernel/src/arch/aarch64/interrupt/context.rs b/kernel/src/arch/aarch64/interrupt/context.rs deleted file mode 100644 index 34389e25..00000000 --- a/kernel/src/arch/aarch64/interrupt/context.rs +++ /dev/null @@ -1,246 +0,0 @@ -//! TrapFrame and context definitions for aarch64. - -use aarch64::barrier; -use aarch64::paging::PhysFrame; -use aarch64::translation::{local_invalidate_tlb_all, ttbr_el1_read, ttbr_el1_write_asid}; -use lazy_static::lazy_static; -use spin::Mutex; - -#[repr(C)] -#[derive(Default, Debug, Copy, Clone)] -pub struct TrapFrame { - pub elr: usize, - pub spsr: usize, - pub sp: usize, - pub tpidr: usize, // currently unused - // pub q0to31: [u128; 32], // disable SIMD/FP registers - pub x1to29: [usize; 29], - pub __reserved: usize, - pub x30: usize, // lr - pub x0: usize, -} - -/// 用于在内核栈中构造新线程的中断帧 -impl TrapFrame { - fn new_kernel_thread(entry: extern "C" fn(usize) -> !, arg: usize, sp: usize) -> Self { - use core::mem::zeroed; - let mut tf: Self = unsafe { zeroed() }; - tf.x0 = arg; - tf.sp = sp; - tf.elr = entry as usize; - tf.spsr = 0b1101_00_0101; // To EL 1, enable IRQ - tf - } - - pub fn new_user_thread(entry_addr: usize, sp: usize) -> Self { - use core::mem::zeroed; - let mut tf: Self = unsafe { zeroed() }; - tf.sp = sp; - tf.elr = entry_addr; - tf.spsr = 0b1101_00_0000; // To EL 0, enable IRQ - tf - } - - pub fn get_sp(&self) -> usize { - self.sp - } -} - -/// 新线程的内核栈初始内容 -#[derive(Debug)] -#[repr(C)] -pub struct InitStack { - context: ContextData, - tf: TrapFrame, -} - -impl InitStack { - unsafe fn push_at(self, stack_top: usize, ttbr: usize) -> Context { - let ptr = (stack_top as *mut Self).offset(-1); - *ptr = self; - Context { - stack_top: ptr as usize, - ttbr: PhysFrame::of_addr(ttbr as u64), - asid: Asid::default(), - } - } -} - -extern "C" { - fn __trapret(); -} - -#[derive(Debug, Default)] -#[repr(C)] -struct ContextData { - x19to29: [usize; 11], - lr: usize, -} - -impl ContextData { - fn new() -> Self { - ContextData { - lr: __trapret as usize, - ..ContextData::default() - } - } -} - -#[derive(Debug)] -pub struct Context { - stack_top: usize, - ttbr: PhysFrame, - asid: Asid, -} - -impl Context { - /// Switch to another kernel thread. - /// - /// Defined in `trap.S`. - /// - /// Push all callee-saved registers at the current kernel stack. - /// Store current sp, switch to target. - /// Pop all callee-saved registers, then return to the target. - #[naked] - #[inline(never)] - unsafe extern "C" fn __switch(_self_stack: &mut usize, _target_stack: &mut usize) { - llvm_asm!( - " - mov x10, #-(12 * 8) - add x8, sp, x10 - str x8, [x0] - stp x19, x20, [x8], #16 // store callee-saved registers - stp x21, x22, [x8], #16 - stp x23, x24, [x8], #16 - stp x25, x26, [x8], #16 - stp x27, x28, [x8], #16 - stp x29, lr, [x8], #16 - - ldr x8, [x1] - ldp x19, x20, [x8], #16 // restore callee-saved registers - ldp x21, x22, [x8], #16 - ldp x23, x24, [x8], #16 - ldp x25, x26, [x8], #16 - ldp x27, x28, [x8], #16 - ldp x29, lr, [x8], #16 - mov sp, x8 - - str xzr, [x1] - ret" - : : : : "volatile" ); - } - - pub unsafe fn switch(&mut self, target: &mut Self) { - self.ttbr = ttbr_el1_read(0); - target.asid = ASID_ALLOCATOR.lock().alloc(target.asid); - - // with ASID we needn't flush TLB frequently - ttbr_el1_write_asid(0, target.asid.value, target.ttbr); - barrier::dsb(barrier::ISH); - Self::__switch(&mut self.stack_top, &mut target.stack_top); - } - - pub unsafe fn null() -> Self { - Context { - stack_top: 0, - ttbr: PhysFrame::of_addr(0), - asid: Asid::default(), - } - } - - pub unsafe fn new_kernel_thread( - entry: extern "C" fn(usize) -> !, - arg: usize, - kstack_top: usize, - ttbr: usize, - ) -> Self { - InitStack { - context: ContextData::new(), - tf: TrapFrame::new_kernel_thread(entry, arg, kstack_top), - } - .push_at(kstack_top, ttbr) - } - pub unsafe fn new_user_thread( - entry_addr: usize, - ustack_top: usize, - kstack_top: usize, - ttbr: usize, - ) -> Self { - InitStack { - context: ContextData::new(), - tf: TrapFrame::new_user_thread(entry_addr, ustack_top), - } - .push_at(kstack_top, ttbr) - } - pub unsafe fn new_fork(tf: &TrapFrame, kstack_top: usize, ttbr: usize) -> Self { - InitStack { - context: ContextData::new(), - tf: { - let mut tf = tf.clone(); - tf.x0 = 0; - tf - }, - } - .push_at(kstack_top, ttbr) - } - pub unsafe fn new_clone( - tf: &TrapFrame, - ustack_top: usize, - kstack_top: usize, - ttbr: usize, - tls: usize, - ) -> Self { - InitStack { - context: ContextData::new(), - tf: { - let mut tf = tf.clone(); - tf.sp = ustack_top; - tf.tpidr = tls; - tf.x0 = 0; - tf - }, - } - .push_at(kstack_top, ttbr) - } -} - -const ASID_MASK: u16 = 0xffff; - -#[derive(Debug, Copy, Clone, Default)] -#[repr(C)] -struct Asid { - value: u16, - generation: u16, -} - -struct AsidAllocator(Asid); - -impl AsidAllocator { - fn new() -> Self { - AsidAllocator(Asid { - value: 0, - generation: 1, - }) - } - - fn alloc(&mut self, old_asid: Asid) -> Asid { - if self.0.generation == old_asid.generation { - return old_asid; - } - - if self.0.value == ASID_MASK { - self.0.value = 0; - self.0.generation = self.0.generation.wrapping_add(1); - if self.0.generation == 0 { - self.0.generation += 1; - } - local_invalidate_tlb_all(); - } - self.0.value += 1; - return self.0; - } -} - -lazy_static! { - static ref ASID_ALLOCATOR: Mutex = Mutex::new(AsidAllocator::new()); -} diff --git a/kernel/src/arch/aarch64/interrupt/handler.rs b/kernel/src/arch/aarch64/interrupt/handler.rs index ca45e3ba..3d277d44 100644 --- a/kernel/src/arch/aarch64/interrupt/handler.rs +++ b/kernel/src/arch/aarch64/interrupt/handler.rs @@ -1,15 +1,12 @@ //! Trap handler -use super::context::TrapFrame; use super::syndrome::{Fault, Syndrome}; use crate::arch::board::irq::{handle_irq, is_timer_irq}; +use trapframe::TrapFrame; use aarch64::regs::*; use log::*; -global_asm!(include_str!("trap.S")); -global_asm!(include_str!("vector.S")); - #[repr(u16)] #[derive(Debug, PartialEq, Eq, Copy, Clone)] pub enum Kind { @@ -60,9 +57,9 @@ pub extern "C" fn rust_trap(info: Info, esr: u32, tf: &mut TrapFrame) { Fault::Translation | Fault::AccessFlag | Fault::Permission => { handle_page_fault(tf) } - _ => crate::trap::error(tf), + _ => panic!(), // crate::trap::error(tf), }, - _ => crate::trap::error(tf), + _ => panic!(), //crate::trap::error(tf), } } Kind::Irq => { @@ -72,7 +69,7 @@ pub extern "C" fn rust_trap(info: Info, esr: u32, tf: &mut TrapFrame) { handle_irq(tf) } } - _ => crate::trap::error(tf), + _ => panic!(), } trace!("Exception end"); } @@ -84,7 +81,8 @@ fn handle_break(_num: u16, tf: &mut TrapFrame) { fn handle_syscall(num: u16, tf: &mut TrapFrame) { if num != 0 { - crate::trap::error(tf); + panic!() + //crate::trap::error(tf); } syscall(tf) @@ -92,6 +90,7 @@ fn handle_syscall(num: u16, tf: &mut TrapFrame) { pub fn syscall(tf: &mut TrapFrame) { // svc instruction has been skipped in syscall (ref: J1.1.2, page 6152) + /* let ret = crate::syscall::syscall( tf.x1to29[7] as usize, [ @@ -105,17 +104,17 @@ pub fn syscall(tf: &mut TrapFrame) { tf, ); tf.x0 = ret as usize; + */ } fn handle_timer() { - crate::arch::timer::set_next(); + crate::arch::board::timer::set_next(); crate::trap::timer(); } fn handle_page_fault(tf: &mut TrapFrame) { let addr = FAR_EL1.get() as usize; if !crate::memory::handle_page_fault(addr) { - error!("\nEXCEPTION: Page Fault @ {:#x}", addr); - crate::trap::error(tf); + panic!("\nEXCEPTION: Page Fault @ {:#x}", addr); } } diff --git a/kernel/src/arch/aarch64/interrupt/mod.rs b/kernel/src/arch/aarch64/interrupt/mod.rs index e861a454..3bf0f589 100644 --- a/kernel/src/arch/aarch64/interrupt/mod.rs +++ b/kernel/src/arch/aarch64/interrupt/mod.rs @@ -1,12 +1,12 @@ //! Interrupt and exception for aarch64. -mod context; +pub mod consts; mod handler; mod syndrome; use aarch64::regs::*; +use trapframe::UserContext; -pub use self::context::*; pub use self::handler::*; /// Set the exception vector address @@ -14,7 +14,7 @@ pub fn init() { extern "C" { fn __vectors(); } - VBAR_EL1.set(__vectors as u64); + //VBAR_EL1.set(__vectors as u64); } /// Enable the interrupt (only IRQ). @@ -47,3 +47,20 @@ pub unsafe fn disable_and_store() -> usize { pub unsafe fn restore(flags: usize) { DAIF.set(flags as u32); } + +pub fn timer() { + // TODO +} + +pub fn ack(_irq: usize) { + // TODO +} + +pub fn get_trap_num(cx: &UserContext) -> usize { + // TODO + 0 +} + +pub fn enable_irq(irq: usize) { + // TODO +} diff --git a/kernel/src/arch/aarch64/interrupt/trap.S b/kernel/src/arch/aarch64/interrupt/trap.S deleted file mode 100644 index 331ba41a..00000000 --- a/kernel/src/arch/aarch64/interrupt/trap.S +++ /dev/null @@ -1,103 +0,0 @@ -.section .text - -.macro SAVE_ALL - # lr, x0 is saved in HANDLER - str x29, [sp, #-16]! - stp x27, x28, [sp, #-16]! - stp x25, x26, [sp, #-16]! - stp x23, x24, [sp, #-16]! - stp x21, x22, [sp, #-16]! - stp x19, x20, [sp, #-16]! - stp x17, x18, [sp, #-16]! - stp x15, x16, [sp, #-16]! - stp x13, x14, [sp, #-16]! - stp x11, x12, [sp, #-16]! - stp x9, x10, [sp, #-16]! - stp x7, x8, [sp, #-16]! - stp x5, x6, [sp, #-16]! - stp x3, x4, [sp, #-16]! - stp x1, x2, [sp, #-16]! - - # stp q30, q31, [sp, #-32]! - # stp q28, q29, [sp, #-32]! - # stp q26, q27, [sp, #-32]! - # stp q24, q25, [sp, #-32]! - # stp q22, q23, [sp, #-32]! - # stp q20, q21, [sp, #-32]! - # stp q18, q19, [sp, #-32]! - # stp q16, q17, [sp, #-32]! - # stp q14, q15, [sp, #-32]! - # stp q12, q13, [sp, #-32]! - # stp q10, q11, [sp, #-32]! - # stp q8, q9, [sp, #-32]! - # stp q6, q7, [sp, #-32]! - # stp q4, q5, [sp, #-32]! - # stp q2, q3, [sp, #-32]! - # stp q0, q1, [sp, #-32]! - - mrs x2, tpidr_el0 - mrs x1, sp_el0 - stp x1, x2, [sp, #-16]! - - mrs x2, spsr_el1 - mrs x1, elr_el1 - stp x1, x2, [sp, #-16]! -.endm - -.macro RESTORE_ALL - ldp x1, x2, [sp], #16 - msr elr_el1, x1 - msr spsr_el1, x2 - - ldp x1, x2, [sp], #16 - msr sp_el0, x1 - msr tpidr_el0, x2 - - # ldp q0, q1, [sp], #32 - # ldp q2, q3, [sp], #32 - # ldp q4, q5, [sp], #32 - # ldp q6, q7, [sp], #32 - # ldp q8, q9, [sp], #32 - # ldp q10, q11, [sp], #32 - # ldp q12, q13, [sp], #32 - # ldp q14, q15, [sp], #32 - # ldp q16, q17, [sp], #32 - # ldp q18, q19, [sp], #32 - # ldp q20, q21, [sp], #32 - # ldp q22, q23, [sp], #32 - # ldp q24, q25, [sp], #32 - # ldp q26, q27, [sp], #32 - # ldp q28, q29, [sp], #32 - # ldp q30, q31, [sp], #32 - - ldp x1, x2, [sp], #16 - ldp x3, x4, [sp], #16 - ldp x5, x6, [sp], #16 - ldp x7, x8, [sp], #16 - ldp x9, x10, [sp], #16 - ldp x11, x12, [sp], #16 - ldp x13, x14, [sp], #16 - ldp x15, x16, [sp], #16 - ldp x17, x18, [sp], #16 - ldp x19, x20, [sp], #16 - ldp x21, x22, [sp], #16 - ldp x23, x24, [sp], #16 - ldp x25, x26, [sp], #16 - ldp x27, x28, [sp], #16 - ldr x29, [sp], #16 - ldp lr, x0, [sp], #16 -.endm - -.global __alltraps -__alltraps: - SAVE_ALL - - # x0 is set in HANDLER - mrs x1, esr_el1 - mov x2, sp - bl rust_trap - -.global __trapret -__trapret: - RESTORE_ALL - eret diff --git a/kernel/src/arch/aarch64/interrupt/vector.S b/kernel/src/arch/aarch64/interrupt/vector.S deleted file mode 100644 index 3a749f94..00000000 --- a/kernel/src/arch/aarch64/interrupt/vector.S +++ /dev/null @@ -1,29 +0,0 @@ -.section .text - -.macro HANDLER source kind - .align 7 - stp lr, x0, [sp, #-16]! - mov x0, #\source - movk x0, #\kind, lsl #16 - b __alltraps -.endm - -.global __vectors -.align 11 -__vectors: - HANDLER 0 0 - HANDLER 0 1 - HANDLER 0 2 - HANDLER 0 3 - HANDLER 1 0 - HANDLER 1 1 - HANDLER 1 2 - HANDLER 1 3 - HANDLER 2 0 - HANDLER 2 1 - HANDLER 2 2 - HANDLER 2 3 - HANDLER 3 0 - HANDLER 3 1 - HANDLER 3 2 - HANDLER 3 3 diff --git a/kernel/src/arch/aarch64/memory.rs b/kernel/src/arch/aarch64/memory.rs index c160d584..0b4c60cb 100644 --- a/kernel/src/arch/aarch64/memory.rs +++ b/kernel/src/arch/aarch64/memory.rs @@ -129,3 +129,12 @@ extern "C" { fn _start(); fn _end(); } + +pub fn set_page_table(vmtoken: usize) { + // TODO +} + +pub fn get_page_fault_addr() -> usize { + // TODO + 0 +} diff --git a/kernel/src/arch/aarch64/mod.rs b/kernel/src/arch/aarch64/mod.rs index 38eecb7d..a129a1e4 100644 --- a/kernel/src/arch/aarch64/mod.rs +++ b/kernel/src/arch/aarch64/mod.rs @@ -33,7 +33,7 @@ pub extern "C" fn master_main() -> ! { crate::logging::init(); interrupt::init(); memory::init(); - timer::init(); + //timer::init(); crate::lkm::manager::ModuleManager::init(); driver::init(); println!("{}", LOGO); @@ -56,7 +56,7 @@ pub extern "C" fn others_main() -> ! { interrupt::init(); memory::init_other(); - timer::init(); + //timer::init(); crate::kmain(); } diff --git a/kernel/src/arch/aarch64/signal.rs b/kernel/src/arch/aarch64/signal.rs index c40562a4..b4136b7b 100644 --- a/kernel/src/arch/aarch64/signal.rs +++ b/kernel/src/arch/aarch64/signal.rs @@ -1,4 +1,4 @@ -use crate::arch::interrupt::TrapFrame; +use trapframe::TrapFrame; #[repr(C)] #[derive(Clone, Debug)] diff --git a/kernel/src/arch/aarch64/timer.rs b/kernel/src/arch/aarch64/timer.rs index 8b137891..8cf73334 100644 --- a/kernel/src/arch/aarch64/timer.rs +++ b/kernel/src/arch/aarch64/timer.rs @@ -1 +1,6 @@ +use core::time::Duration; +pub fn timer_now() -> Duration { + // TODO + Duration::from_nanos(0) +}