aarch64: make kernel build

This commit is contained in:
Mark Poliakov 2023-08-07 10:28:04 +03:00
parent 7b525c4085
commit 44a888c39a
2 changed files with 16 additions and 10 deletions

View File

@ -108,6 +108,10 @@ impl Architecture for AArch64 {
fn interrupt_mask() -> bool { fn interrupt_mask() -> bool {
DAIF.read(DAIF::I) != 0 DAIF.read(DAIF::I) != 0
} }
fn cpu_count() -> usize {
CPU_COUNT.load(Ordering::Acquire)
}
} }
impl AArch64 { impl AArch64 {
@ -203,10 +207,9 @@ pub fn kernel_main(dtb_phys: usize) -> ! {
AArch64::set_interrupt_mask(true); AArch64::set_interrupt_mask(true);
ARCHITECTURE.init_device_tree(dtb_phys); ARCHITECTURE.init_device_tree(dtb_phys);
PLATFORM.init_primary_debug_sink(); PLATFORM.init_debug();
} }
// Setup debugging functions debug::reset();
debug::init();
exception::init_exceptions(); exception::init_exceptions();

View File

@ -4,9 +4,10 @@ use abi::error::Error;
use tock_registers::interfaces::Writeable; use tock_registers::interfaces::Writeable;
use crate::{ use crate::{
debug::DebugSink, arch::CpuMessage,
debug::{self, DebugSink, LogLevel},
device::{ device::{
interrupt::{ExternalInterruptController, InterruptSource}, interrupt::{ExternalInterruptController, InterruptSource, IpiDeliveryTarget},
platform::Platform, platform::Platform,
serial::pl011::Pl011, serial::pl011::Pl011,
timer::TimestampSource, timer::TimestampSource,
@ -54,12 +55,9 @@ impl Platform for QemuPlatform {
Ok(()) Ok(())
} }
unsafe fn init_primary_debug_sink(&self) { unsafe fn init_debug(&'static self) {
self.pl011.init(()).ok(); self.pl011.init(()).ok();
} debug::add_sink(&self.pl011, LogLevel::Debug);
fn primary_debug_sink(&self) -> Option<&dyn DebugSink> {
Some(&self.pl011)
} }
fn interrupt_controller( fn interrupt_controller(
@ -75,6 +73,11 @@ impl Platform for QemuPlatform {
fn timestamp_source(&self) -> &dyn TimestampSource { fn timestamp_source(&self) -> &dyn TimestampSource {
&self.local_timer &self.local_timer
} }
unsafe fn send_ipi(&self, target: IpiDeliveryTarget, _msg: CpuMessage) -> Result<(), Error> {
infoln!("TODO send ipi");
loop {}
}
} }
/// AArch64 "virt" platform /// AArch64 "virt" platform