Handle ps2 keyboard via special process
This commit is contained in:
@ -13,6 +13,9 @@
|
||||
#include "vfs/vfs.h"
|
||||
#include "bootinfo/bootinfo.h"
|
||||
#include "ipc/pipe/pipe.h"
|
||||
#include "kproc/kproc.h"
|
||||
#include "ps2kbproc/ps2kbproc.h"
|
||||
#include "termproc/termproc.h"
|
||||
|
||||
#define PROC_REAPER_FREQ 30
|
||||
|
||||
@ -281,30 +284,22 @@ void proc_status(void) {
|
||||
}
|
||||
}
|
||||
|
||||
Proc *kproc = NULL;
|
||||
|
||||
void proc_kproc(void) {
|
||||
char buf[100];
|
||||
hal_memset(buf, 0, sizeof(buf));
|
||||
for (;;) {
|
||||
int32_t read = ipc_piperead(kproc->pipes[1], buf, sizeof(buf));
|
||||
kprintf("%.*s", read, buf);
|
||||
hal_memset(buf, 0, sizeof(buf));
|
||||
}
|
||||
}
|
||||
|
||||
void proc_init(void) {
|
||||
spinlock_init(&PROCS.spinlock);
|
||||
PROCS.procs = NULL;
|
||||
|
||||
kproc = proc_spawnkern(&proc_kproc, "kproc");
|
||||
kproc->pipes[1] = dlmalloc(sizeof(IpcPipe));
|
||||
ipc_pipeinit(kproc->pipes[1]);
|
||||
proc_register(kproc);
|
||||
PROCS.current = kproc;
|
||||
kproc_init(proc_spawnkern(&kproc_fn, "kproc"));
|
||||
proc_register(KPROC);
|
||||
PROCS.current = KPROC;
|
||||
|
||||
ps2kbproc_init(proc_spawnkern(&ps2kbproc_fn, "ps2kbproc"));
|
||||
proc_register(PS2KBPROC);
|
||||
|
||||
termproc_init(proc_spawnkern(&termproc_fn, "termproc"));
|
||||
proc_register(TERMPROC);
|
||||
|
||||
Proc *init = proc_spawnuser("base", "/bin/init");
|
||||
init->pipes[0] = kproc->pipes[1];
|
||||
init->pipes[0] = TERMPROC->pipes[1];
|
||||
proc_register(init);
|
||||
|
||||
hal_switchproc(&PROCS.current->platformdata.trapframe, (void *)PROCS.current->platformdata.cr3);
|
||||
|
Reference in New Issue
Block a user