From f65a5bd79c8f3ce820cab356d35fa7857f5ecc99 Mon Sep 17 00:00:00 2001 From: Talha Qamar Date: Wed, 27 Nov 2024 00:14:01 +0500 Subject: [PATCH] Added interrupt lookup to executor --- kernel/src/task.rs | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/kernel/src/task.rs b/kernel/src/task.rs index 01c6688..33eceb2 100644 --- a/kernel/src/task.rs +++ b/kernel/src/task.rs @@ -1,5 +1,5 @@ use { - alloc::{boxed::Box, sync::Arc}, + alloc::{boxed::Box, sync::Arc, vec::Vec}, core::{ future::Future, pin::Pin, @@ -35,6 +35,7 @@ impl + Send> Process for T {} pub struct Executor { tasks: Slab, task_queue: Arc>, + interrupt_lookup: [Option; u8::MAX as usize], } impl Executor { @@ -42,6 +43,7 @@ impl Executor { Self { tasks: Slab::new(), task_queue: Arc::new(SegQueue::new()), + interrupt_lookup: [None; u8::MAX as usize], } } @@ -98,6 +100,14 @@ impl Executor { } } } + + pub fn send_interrupt(&self, interrupt : u8){ + let id = self.interrupt_lookup[interrupt as usize]; + if let Some(id) = id{ + let task = &self.tasks[id]; + task.set_paused(false); + } + } } struct Task {