x86: fix i686/x86_64 build
This commit is contained in:
parent
60164fedca
commit
a2adff85a7
@ -1,8 +1,7 @@
|
|||||||
use fixed::FixedTables;
|
use fixed::FixedTables;
|
||||||
use kernel_arch_interface::{
|
use kernel_arch_interface::{
|
||||||
mem::{DeviceMemoryAttributes, KernelTableManager, RawDeviceMemoryMapping},
|
mem::{DeviceMemoryAttributes, KernelTableManager, RawDeviceMemoryMapping},
|
||||||
sync::split_spinlock,
|
split_spinlock, KERNEL_VIRT_OFFSET,
|
||||||
KERNEL_VIRT_OFFSET,
|
|
||||||
};
|
};
|
||||||
use libk_mm_interface::{
|
use libk_mm_interface::{
|
||||||
address::{AsPhysicalAddress, PhysicalAddress},
|
address::{AsPhysicalAddress, PhysicalAddress},
|
||||||
@ -26,7 +25,7 @@ split_spinlock! {
|
|||||||
use crate::ArchitectureImpl;
|
use crate::ArchitectureImpl;
|
||||||
|
|
||||||
#[link_section = ".data.tables"]
|
#[link_section = ".data.tables"]
|
||||||
static KERNEL_TABLES @ inner<lock: ArchitectureImpl>: KernelImageObject<FixedTables> = unsafe {
|
static KERNEL_TABLES: KernelImageObject<FixedTables> = unsafe {
|
||||||
KernelImageObject::new(FixedTables::zeroed())
|
KernelImageObject::new(FixedTables::zeroed())
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -7,14 +7,13 @@ use core::{
|
|||||||
|
|
||||||
use kernel_arch_interface::{
|
use kernel_arch_interface::{
|
||||||
mem::{DeviceMemoryAttributes, KernelTableManager, RawDeviceMemoryMapping},
|
mem::{DeviceMemoryAttributes, KernelTableManager, RawDeviceMemoryMapping},
|
||||||
sync::split_spinlock,
|
split_spinlock,
|
||||||
};
|
};
|
||||||
use kernel_arch_x86::registers::CR3;
|
use kernel_arch_x86::registers::CR3;
|
||||||
use libk_mm_interface::{
|
use libk_mm_interface::{
|
||||||
address::PhysicalAddress,
|
address::PhysicalAddress,
|
||||||
table::{page_index, EntryLevel, EntryLevelExt},
|
table::{page_index, EntryLevel, EntryLevelExt},
|
||||||
};
|
};
|
||||||
use memtables::x86_64::FixedTables;
|
|
||||||
use static_assertions::{const_assert_eq, const_assert_ne};
|
use static_assertions::{const_assert_eq, const_assert_ne};
|
||||||
use yggdrasil_abi::error::Error;
|
use yggdrasil_abi::error::Error;
|
||||||
|
|
||||||
@ -51,12 +50,12 @@ const RAM_MAPPING_L0I: usize = KERNEL_L0_INDEX - 1;
|
|||||||
const DEVICE_MAPPING_L3_COUNT: usize = 4;
|
const DEVICE_MAPPING_L3_COUNT: usize = 4;
|
||||||
|
|
||||||
split_spinlock! {
|
split_spinlock! {
|
||||||
use crate::ArchitectureImpl;
|
|
||||||
use crate::mem::FixedTables;
|
|
||||||
use libk_mm_interface::KernelImageObject;
|
use libk_mm_interface::KernelImageObject;
|
||||||
|
use memtables::x86_64::FixedTables;
|
||||||
|
use crate::ArchitectureImpl;
|
||||||
|
|
||||||
#[link_section = ".data.tables"]
|
#[link_section = ".data.tables"]
|
||||||
static KERNEL_TABLES @ inner<lock: ArchitectureImpl>: KernelImageObject<FixedTables> =
|
static KERNEL_TABLES: KernelImageObject<FixedTables> =
|
||||||
unsafe { KernelImageObject::new(FixedTables::zeroed()) };
|
unsafe { KernelImageObject::new(FixedTables::zeroed()) };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,10 +177,6 @@ impl InterruptHandler for AhciController {
|
|||||||
|
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"AHCI IRQ"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for AhciController {
|
impl Device for AhciController {
|
||||||
|
@ -337,10 +337,6 @@ impl InterruptHandler for NvmeController {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"NVMe IRQ"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for NvmeController {
|
impl Device for NvmeController {
|
||||||
|
@ -378,8 +378,4 @@ impl InterruptHandler for Xhci {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"xHCI IRQ"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -253,10 +253,6 @@ impl<T: Transport + 'static> InterruptHandler for VirtioNet<T> {
|
|||||||
queue_irq || config_irq
|
queue_irq || config_irq
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"virtio-net transport IRQ"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl<T: Transport + 'static> MsiHandler for VirtioNet<T> {
|
// impl<T: Transport + 'static> MsiHandler for VirtioNet<T> {
|
||||||
|
@ -66,9 +66,8 @@ pub enum IpiMessage {
|
|||||||
Shutdown,
|
Shutdown,
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait InterruptHandler: Sync + Send {
|
pub trait InterruptHandler: Device {
|
||||||
fn handle_irq(self: Arc<Self>, vector: Option<usize>) -> bool;
|
fn handle_irq(self: Arc<Self>, vector: Option<usize>) -> bool;
|
||||||
fn display_name(&self) -> &str;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub trait InterruptTable: Sync {
|
pub trait InterruptTable: Sync {
|
||||||
@ -143,16 +142,6 @@ pub struct FixedInterruptTable<const N: usize> {
|
|||||||
rows: [Option<Arc<dyn InterruptHandler>>; N],
|
rows: [Option<Arc<dyn InterruptHandler>>; N],
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<F: Fn(Option<usize>) -> bool + Sync + Send> InterruptHandler for F {
|
|
||||||
fn handle_irq(self: Arc<Self>, vector: Option<usize>) -> bool {
|
|
||||||
self(vector)
|
|
||||||
}
|
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"<closure>"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
impl<const N: usize> FixedInterruptTable<N> {
|
impl<const N: usize> FixedInterruptTable<N> {
|
||||||
pub const fn new() -> Self {
|
pub const fn new() -> Self {
|
||||||
Self {
|
Self {
|
||||||
@ -190,13 +179,6 @@ impl<const N: usize> InterruptTable for FixedInterruptTable<N> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// pub trait LocalInterruptController {
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// pub struct FixedInterruptTable<const SIZE: usize> {
|
|
||||||
// entries: [Option<&'static dyn InterruptHandler>; SIZE],
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
impl IrqLevel {
|
impl IrqLevel {
|
||||||
pub fn override_default(self, value: IrqLevel) -> Self {
|
pub fn override_default(self, value: IrqLevel) -> Self {
|
||||||
match self {
|
match self {
|
||||||
|
@ -48,10 +48,6 @@ impl InterruptHandler for ArmTimer {
|
|||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"ARM Generic Timer"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for ArmTimer {
|
impl Device for ArmTimer {
|
||||||
|
@ -119,10 +119,6 @@ impl InterruptHandler for HpetTimer {
|
|||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
self.name.as_str()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for HpetTimer {
|
impl Device for HpetTimer {
|
||||||
|
@ -32,10 +32,6 @@ pub struct I8253 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl InterruptHandler for I8253 {
|
impl InterruptHandler for I8253 {
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"i8253 PIT"
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handle_irq(self: Arc<Self>, _vector: Option<usize>) -> bool {
|
fn handle_irq(self: Arc<Self>, _vector: Option<usize>) -> bool {
|
||||||
self.irq_handler_fastpath();
|
self.irq_handler_fastpath();
|
||||||
true
|
true
|
||||||
|
@ -106,10 +106,6 @@ impl InterruptHandler for PS2Controller {
|
|||||||
|
|
||||||
count != 0
|
count != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"PS/2 Keyboard Interrupt"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for PS2Controller {
|
impl Device for PS2Controller {
|
||||||
|
@ -141,10 +141,6 @@ impl InterruptHandler for Rtc {
|
|||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"x86 RTC IRQ"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for Rtc {
|
impl Device for Rtc {
|
||||||
|
@ -97,17 +97,6 @@ impl DebugSink for Port {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// impl SerialDevice for Port {
|
|
||||||
// fn send_byte(&self, byte: u8) -> Result<(), Error> {
|
|
||||||
// let mut inner = self.inner.lock();
|
|
||||||
// inner.write(byte)
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// fn is_terminal(&self) -> bool {
|
|
||||||
// false
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
impl InterruptHandler for Port {
|
impl InterruptHandler for Port {
|
||||||
fn handle_irq(self: Arc<Self>, _vector: Option<usize>) -> bool {
|
fn handle_irq(self: Arc<Self>, _vector: Option<usize>) -> bool {
|
||||||
let inner = self.terminal.output();
|
let inner = self.terminal.output();
|
||||||
@ -118,10 +107,6 @@ impl InterruptHandler for Port {
|
|||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"x86 COM port IRQ"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for Port {
|
impl Device for Port {
|
||||||
|
@ -11,7 +11,10 @@ use acpi_system::{
|
|||||||
AcpiInterruptMethod, AcpiSleepState, AcpiSystem, AcpiSystemError, EventAction, FixedEvent,
|
AcpiInterruptMethod, AcpiSleepState, AcpiSystem, AcpiSystemError, EventAction, FixedEvent,
|
||||||
};
|
};
|
||||||
use alloc::{boxed::Box, sync::Arc};
|
use alloc::{boxed::Box, sync::Arc};
|
||||||
use device_api::interrupt::{InterruptHandler, IpiDeliveryTarget, IpiMessage, Irq};
|
use device_api::{
|
||||||
|
device::Device,
|
||||||
|
interrupt::{InterruptHandler, IpiDeliveryTarget, IpiMessage, Irq},
|
||||||
|
};
|
||||||
use kernel_arch_x86_64::CPU_COUNT;
|
use kernel_arch_x86_64::CPU_COUNT;
|
||||||
use libk::device::external_interrupt_controller;
|
use libk::device::external_interrupt_controller;
|
||||||
use libk_mm::{
|
use libk_mm::{
|
||||||
@ -48,16 +51,18 @@ static ACPI_SYSTEM: OneTimeInit<IrqSafeSpinlock<AcpiSystem<AcpiHandlerImpl>>> =
|
|||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
impl Device for SciHandler {
|
||||||
|
fn display_name(&self) -> &str {
|
||||||
|
"ACPI SCI Handler"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl InterruptHandler for SciHandler {
|
impl InterruptHandler for SciHandler {
|
||||||
fn handle_irq(self: Arc<Self>, _vector: Option<usize>) -> bool {
|
fn handle_irq(self: Arc<Self>, _vector: Option<usize>) -> bool {
|
||||||
log::trace!("ACPI SCI received");
|
log::trace!("ACPI SCI received");
|
||||||
ACPI_SYSTEM.get().lock().handle_sci();
|
ACPI_SYSTEM.get().lock().handle_sci();
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"ACPI SCI Handler"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsafe impl Allocator for AcpiAllocator {
|
unsafe impl Allocator for AcpiAllocator {
|
||||||
|
@ -139,10 +139,6 @@ impl InterruptHandler for Bcm2835AuxUart {
|
|||||||
|
|
||||||
status
|
status
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"BCM283x mini-UART IRQ"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for Bcm2835AuxUart {
|
impl Device for Bcm2835AuxUart {
|
||||||
|
@ -134,10 +134,6 @@ impl InterruptHandler for Pl011 {
|
|||||||
|
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
fn display_name(&self) -> &str {
|
|
||||||
"PL011 IRQ"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Device for Pl011 {
|
impl Device for Pl011 {
|
||||||
|
@ -129,7 +129,7 @@ impl BuildEnv {
|
|||||||
(Arch::aarch64, Board::virt | Board::default) => "aarch64-unknown-qemu",
|
(Arch::aarch64, Board::virt | Board::default) => "aarch64-unknown-qemu",
|
||||||
(Arch::aarch64, Board::raspi4b) => "aarch64-unknown-raspi4b",
|
(Arch::aarch64, Board::raspi4b) => "aarch64-unknown-raspi4b",
|
||||||
(Arch::x86_64, Board::default) => "x86_64-unknown-none",
|
(Arch::x86_64, Board::default) => "x86_64-unknown-none",
|
||||||
(Arch::i686, Board::default) => "x86_64-unknown-none",
|
(Arch::i686, Board::default) => "i686-unknown-none",
|
||||||
_ => {
|
_ => {
|
||||||
log::error!("Invalid arch/board combination: {arch:?}/{board:?}");
|
log::error!("Invalid arch/board combination: {arch:?}/{board:?}");
|
||||||
panic!();
|
panic!();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user