Skip to content
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions modules/axconfig/src/platform/pc-x86.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ mmio-regions = [
["0xfec0_0000", "0x1000"], # IO APIC
["0xfed0_0000", "0x1000"], # HPET
["0xfee0_0000", "0x1000"], # Local APIC
["0xe_0000", "0x2_0000"], #ACPI
]
# VirtIO MMIO regions with format (`base_paddr`, `size`).
virtio-mmio-regions = []
Expand Down
2 changes: 2 additions & 0 deletions modules/axhal/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ x86 = "0.52"
x86_64 = "0.14"
x2apic = "0.4"
raw-cpuid = "11.0"
acpi = "4.1.1"
aml = "0.16.4"

[target.'cfg(any(target_arch = "riscv32", target_arch = "riscv64"))'.dependencies]
riscv = "0.10"
Expand Down
3 changes: 2 additions & 1 deletion modules/axhal/src/arch/x86_64/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ mod context;
mod gdt;
mod idt;

#[cfg(target_os = "none")]
// #[cfg(target_os = "none")]
mod trap;

use core::arch::asm;
Expand All @@ -14,6 +14,7 @@ use x86_64::instructions::interrupts;
pub use self::context::{ExtendedState, FxsaveArea, TaskContext, TrapFrame};
pub use self::gdt::GdtStruct;
pub use self::idt::IdtStruct;
pub use self::trap::{irq_to_vector, vector_to_irq};
pub use x86_64::structures::tss::TaskStateSegment;

/// Allows the current CPU to respond to interrupts.
Expand Down
9 changes: 9 additions & 0 deletions modules/axhal/src/arch/x86_64/trap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,3 +44,12 @@ fn x86_trap_handler(tf: &mut TrapFrame) {
}
}
}

/// map external IRQ to vector
pub fn irq_to_vector(irq: u8) -> usize {
(irq + IRQ_VECTOR_START) as usize
}
/// map vector to external IRQ
pub fn vector_to_irq(vector: usize) -> u8 {
vector as u8 - IRQ_VECTOR_START
}
2 changes: 1 addition & 1 deletion modules/axhal/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
#[macro_use]
extern crate log;

mod platform;
pub mod platform;

pub mod arch;
pub mod cpu;
Expand Down
Loading