mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
When waking another thread, if that thread has a more urgent priority than the current thread on the same CPU, send that CPU an IPI to tell it to run its scheduler. Related changes in this commit: - Addition of the ipiSchedule isr (vector 0xe4) and its handler in isr_handler(). - Change the APIC's send_ipi* functions to take an isr enum and not an int for their vector parameter - Thread TCBs now contain a pointer to their current CPU's cpu_data structure - Add the maybe_schedule() call to the scheduler, which sends the schedule IPI to the given thread's CPU only when that CPU is running a less-urgent thread. - Move the locking of a run queue lock earlier in schedule() instead of taking the lock in steal_work() and again in schedule().
38 lines
843 B
C++
38 lines
843 B
C++
#pragma once
|
|
/// \file interrupts.h
|
|
/// Free functions and definitions related to interrupt service vectors
|
|
#include <stdint.h>
|
|
|
|
|
|
/// Enum of all defined ISR/IRQ vectors
|
|
enum class isr : uint8_t
|
|
{
|
|
#define ISR(i, s, name) name = i,
|
|
#define NISR(i, s, name) name = i,
|
|
#define EISR(i, s, name) name = i,
|
|
#define IRQ(i, q, name) name = i,
|
|
#include "interrupt_isrs.inc"
|
|
#undef IRQ
|
|
#undef EISR
|
|
#undef NISR
|
|
#undef ISR
|
|
|
|
_zero = 0
|
|
};
|
|
|
|
/// Helper operator to add an offset to an isr vector
|
|
constexpr isr operator+(const isr &lhs, int rhs) {
|
|
return static_cast<isr>(static_cast<uint8_t>(lhs) + rhs);
|
|
}
|
|
|
|
extern "C" {
|
|
/// Set the CPU interrupt enable flag (sti)
|
|
void interrupts_enable();
|
|
|
|
/// Set the CPU interrupt disable flag (cli)
|
|
void interrupts_disable();
|
|
}
|
|
|
|
/// Disable the legacy PIC
|
|
void disable_legacy_pic();
|