From 7e06efa530ce6ee5ccc49e553b133ae52cafd468 Mon Sep 17 00:00:00 2001 From: Stefan Lankes Date: Sun, 3 Nov 2024 23:55:52 +0100 Subject: [PATCH] use usize as type for the prio_bitmap - usize fits always in a register --- src/arch/x86/kernel/processor.rs | 4 ++-- src/scheduler/scheduler.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/arch/x86/kernel/processor.rs b/src/arch/x86/kernel/processor.rs index a06758b..71e304f 100644 --- a/src/arch/x86/kernel/processor.rs +++ b/src/arch/x86/kernel/processor.rs @@ -7,11 +7,11 @@ use x86::controlregs::*; /// Search the least significant bit #[inline(always)] -pub(crate) fn lsb(i: u64) -> u64 { +pub(crate) fn lsb(i: usize) -> usize { let ret; if i == 0 { - ret = !0u64; + ret = !0usize; } else { unsafe { asm!("bsf {0}, {1}", diff --git a/src/scheduler/scheduler.rs b/src/scheduler/scheduler.rs index 53c0ff7..f76e13e 100755 --- a/src/scheduler/scheduler.rs +++ b/src/scheduler/scheduler.rs @@ -20,7 +20,7 @@ pub struct Scheduler { /// queue of tasks, which are ready ready_queues: [TaskQueue; NO_PRIORITIES], /// Bitmap to show, which queue is uesed - prio_bitmap: u64, + prio_bitmap: usize, /// queue of tasks, which are finished and can be released finished_tasks: VecDeque, // map between task id and task controll block @@ -99,7 +99,7 @@ impl Scheduler { let i = lsb(self.prio_bitmap); let mut task = None; - if i <= prio.into() as u64 { + if i <= prio.into().into() { task = self.ready_queues[i as usize].pop(); // clear bitmap entry for the priority i if the queus is empty