Files
mop3/kernel/device/debugconsole.c
kamkow1 cd5604da43
All checks were successful
Build documentation / build-and-deploy (push) Successful in 3m35s
Use macro wrappers for device op prototypes
2026-03-15 14:27:54 +01:00

33 lines
706 B
C

#include <device/debugconsole.h>
#include <device/device.h>
#include <libk/std.h>
#include <proc/proc.h>
#include <proc/reschedule.h>
#include <status.h>
#include <sys/debug.h>
DEFINE_DEVICE_INIT (debugconsole_init) {
(void)device, (void)arg, (void)proc, (void)rctx;
return true;
}
DEFINE_DEVICE_FINI (debugconsole_fini) {}
DEFINE_DEVICE_OP (debugconsole_putstr) {
uint64_t fp;
char* string = (char*)a1;
size_t* len = (size_t*)a2;
if (string == NULL || len == NULL)
return -ST_BAD_ADDRESS_SPACE;
spin_lock (&proc->lock, &fp);
int pid = proc->pid;
spin_unlock (&proc->lock, fp);
debugprintf ("(CPU %d; PID %d) %.*s\n", thiscpu->id, pid, (int)*len, string);
return ST_OK;
}