29 lines
623 B
C
29 lines
623 B
C
#include <device/device.h>
|
|
#include <device/sys/debugconsole.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) {
|
|
char* string = (char*)a1;
|
|
size_t* len = (size_t*)a2;
|
|
|
|
if (string == NULL || len == NULL)
|
|
return -ST_BAD_ADDRESS_SPACE;
|
|
|
|
int pid = proc->pid;
|
|
|
|
debugprintf("(CPU %d; PID %d) %.*s", thiscpu->id, pid, (int)*len, string);
|
|
|
|
return ST_OK;
|
|
}
|