Spinlock save cpu flags

This commit is contained in:
2026-03-12 22:48:34 +01:00
parent 19793e9126
commit 4760818118
50 changed files with 704 additions and 461 deletions

View File

@@ -6,7 +6,8 @@
#include <status.h>
#include <sys/debug.h>
bool debugconsole_init (struct device* device, void* arg, struct proc* proc, struct reschedule_ctx* rctx) {
bool debugconsole_init (struct device* device, void* arg, struct proc* proc,
struct reschedule_ctx* rctx) {
(void)device, (void)arg, (void)proc, (void)rctx;
return true;
}
@@ -18,6 +19,7 @@ void debugconsole_fini (struct device* device, struct proc* proc, struct resched
int debugconsole_putstr (struct device* device, struct proc* proc, struct reschedule_ctx* rctx,
void* a1, void* a2, void* a3, void* a4) {
(void)a2, (void)a3, (void)a4, (void)device, (void)rctx;
uint64_t fp;
char* string = (char*)a1;
size_t* len = (size_t*)a2;
@@ -25,9 +27,9 @@ int debugconsole_putstr (struct device* device, struct proc* proc, struct resche
if (string == NULL || len == NULL)
return -ST_BAD_ADDRESS_SPACE;
spin_lock (&proc->lock);
spin_lock (&proc->lock, &fp);
int pid = proc->pid;
spin_unlock (&proc->lock);
spin_unlock (&proc->lock, fp);
debugprintf ("(CPU %d; PID %d) %.*s\n", thiscpu->id, pid, (int)*len, string);