Redesign reschedule points, allow one operation to reschedule many cpus at once
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m12s

This commit is contained in:
2026-02-18 23:16:03 +01:00
parent ae0a6024da
commit f103bdd739
39 changed files with 376 additions and 223 deletions

View File

@@ -9,6 +9,7 @@
#include <m/status.h>
#include <proc/capability.h>
#include <proc/proc.h>
#include <proc/reschedule.h>
#include <proc/suspension_q.h>
#include <sync/spin_lock.h>
#include <sys/debug.h>
@@ -165,13 +166,13 @@ static int32_t ps2kb_keycode (void) {
return c;
}
static bool ps2kb_irq (struct cpu** reschedule_cpu, void* arg, void* regs) {
static void ps2kb_irq (void* arg, void* regs, struct reschedule_ctx* rctx) {
(void)arg, (void)regs;
int32_t keycode = ps2kb_keycode ();
if (keycode <= 0)
return PROC_NO_RESCHEDULE;
return;
spin_lock (&ps2kb_ringbuffer_lock);
spin_lock (&ps2kb_sq.lock);
@@ -187,20 +188,19 @@ static bool ps2kb_irq (struct cpu** reschedule_cpu, void* arg, void* regs) {
spin_unlock (&ps2kb_sq.lock);
spin_unlock (&ps2kb_ringbuffer_lock);
return proc_sq_resume (resumed_proc, sq_entry, reschedule_cpu);
proc_sq_resume (resumed_proc, sq_entry, rctx);
return;
}
spin_unlock (&ps2kb_sq.lock);
spin_unlock (&ps2kb_ringbuffer_lock);
return PROC_NO_RESCHEDULE;
}
int ps2kb_read_key (struct device* device, struct device_op_ctx* op_ctx, void* a1, void* a2,
void* a3, void* a4) {
int ps2kb_read_key (struct device* device, struct proc* proc, struct reschedule_ctx* rctx, void* a1,
void* a2, void* a3, void* a4) {
(void)device, (void)a2, (void)a3, (void)a4;
if ((op_ctx->proc != NULL) && !(op_ctx->proc->procgroup->capabilities & PROC_CAP_KB))
if (!(proc->procgroup->capabilities & PROC_CAP_KB))
return -ST_PERMISSION_ERROR;
uint8_t* chbuf = (uint8_t*)a1;
@@ -224,8 +224,7 @@ int ps2kb_read_key (struct device* device, struct device_op_ctx* op_ctx, void* a
return -ST_PERMISSION_ERROR;
}
*op_ctx->reschedule =
proc_sq_suspend (op_ctx->proc, &ps2kb_sq, &ps2kb_ringbuffer_lock, op_ctx->reschedule_cpu);
proc_sq_suspend (proc, &ps2kb_sq, &ps2kb_ringbuffer_lock, rctx);
return ST_OK;
}