Skip to content

Commit 5a3fa45

Browse files
committed
fix: adapt x86-qemu-q35 to new axplat
1 parent 562cfdf commit 5a3fa45

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

platform/x86-qemu-q35/src/apic.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,13 @@ mod irq_impl {
147147
/// It is called by the common interrupt handler. It should look up in the
148148
/// IRQ handler table and calls the corresponding handler. If necessary, it
149149
/// also acknowledges the interrupt controller after handling.
150-
fn handle(vector: usize) {
150+
fn handle(vector: usize) -> Option<usize> {
151151
trace!("IRQ {}", vector);
152152
if !IRQ_HANDLER_TABLE.handle(vector) {
153153
warn!("Unhandled IRQ {vector}");
154154
}
155155
unsafe { super::local_apic().end_of_interrupt() };
156+
Some(vector)
156157
}
157158

158159
/// Sends an inter-processor interrupt (IPI) to the specified target CPU or all CPUs.

platform/x86-qemu-q35/src/console.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,4 +46,12 @@ impl ConsoleIf for ConsoleIfImpl {
4646
}
4747
read_len
4848
}
49+
50+
/// Returns the IRQ number for the console input interrupt.
51+
///
52+
/// Returns `None` if input interrupt is not supported.
53+
#[cfg(feature = "irq")]
54+
fn irq_num() -> Option<usize> {
55+
None
56+
}
4957
}

platform/x86-qemu-q35/src/time.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ struct TimeIfImpl;
7777

7878
#[impl_plat_interface]
7979
impl TimeIf for TimeIfImpl {
80-
/// Returns the IRQ number for the timer interrupt.
81-
fn irq_num() -> usize {
82-
0xf0
83-
}
84-
8580
/// Returns the current clock time in hardware ticks.
8681
fn current_ticks() -> u64 {
8782
unsafe { core::arch::x86_64::_rdtsc() - INIT_TICK }
@@ -103,6 +98,12 @@ impl TimeIf for TimeIfImpl {
10398
unsafe { RTC_EPOCHOFFSET_NANOS }
10499
}
105100

101+
/// Returns the IRQ number for the timer interrupt.
102+
#[cfg(feature = "irq")]
103+
fn irq_num() -> usize {
104+
0xf0
105+
}
106+
106107
/// Set a one-shot timer.
107108
///
108109
/// A timer interrupt will be triggered at the specified monotonic time

0 commit comments

Comments
 (0)