ke: make DPC handlers take in DPC pointer as parameter

This commit is contained in:
Loïc Grégoire
2026-06-18 10:38:31 -04:00
parent 797018f86e
commit 42b10b886e
3 changed files with 6 additions and 6 deletions
+3 -3
View File
@@ -11,14 +11,14 @@ pub const Dpc = struct {
/// Entry into per-CPU DPC queue
link: rtl.List.Entry,
/// Routine to call
func: *const fn (?*anyopaque) void,
func: *const fn (*Dpc, ?*anyopaque) void,
/// Argument passed to the routine
arg: ?*anyopaque,
/// Whether or not the DPC is currently inserted
inserted: std.atomic.Value(bool),
/// Initialize a DPC for `func`.
pub fn init(func: *const fn (?*anyopaque) void) Dpc {
pub fn init(func: *const fn (*Dpc, ?*anyopaque) void) Dpc {
return .{
.link = undefined,
.func = func,
@@ -105,7 +105,7 @@ fn dispatch_queue(cpu: u32) void {
dpc_cpu.lock.release(ipl);
std.debug.assert(ke.ipl.current() == .Dispatch);
dpc.func(arg);
dpc.func(dpc, arg);
}
if (sched_cpu.start_timer) {
+2 -2
View File
@@ -189,7 +189,7 @@ pub fn handle_preemption(cpu: *PerCpu) void {
}
/// Called every time slice in DPC context.
pub fn clock(_: ?*anyopaque) void {
pub fn clock(_: *ke.Dpc, _: ?*anyopaque) void {
const cpu = percpu.local();
std.debug.assert(ki.ipl.current() == .Dispatch);
@@ -1019,7 +1019,7 @@ pub fn idle(_: ?*anyopaque) noreturn {
/// Called every second to balance work between CPUs on CPU0.
/// Takes a thread from the most loaded CPU and puts it on the least loaded one.
fn balance(_: ?*anyopaque) void {
fn balance(_: *ke.Dpc, _: ?*anyopaque) void {
var high_mask = ke.CpuMask.init(false);
var low_mask: ke.CpuMask = undefined;
+1 -1
View File
@@ -138,7 +138,7 @@ pub fn clock() void {
}
// Called in a DPC when a timer has expired.
fn handle_expiry(_: ?*anyopaque) void {
fn handle_expiry(_: *ke.Dpc, _: ?*anyopaque) void {
std.debug.assert(ki.ipl.current() == .Dispatch);
const cpu = percpu.local();