summaryrefslogtreecommitdiff
path: root/src/kernel/arch/amd64/driver/ps2.c
diff options
context:
space:
mode:
authordzwdz2022-09-03 14:56:05 +0200
committerdzwdz2022-09-03 14:56:05 +0200
commit9889b47b5216bdcd301e2b63baf71683bcbb22af (patch)
treeaf8879a53ea7f6d249b4143d31a18e5363853d9f /src/kernel/arch/amd64/driver/ps2.c
parent6e4b9831f903e583d58de8b4265159f6d859ebc2 (diff)
driver/ps2,serial: handle all pending reads at the same time
Diffstat (limited to 'src/kernel/arch/amd64/driver/ps2.c')
-rw-r--r--src/kernel/arch/amd64/driver/ps2.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/kernel/arch/amd64/driver/ps2.c b/src/kernel/arch/amd64/driver/ps2.c
index 196b890..51aabea 100644
--- a/src/kernel/arch/amd64/driver/ps2.c
+++ b/src/kernel/arch/amd64/driver/ps2.c
@@ -63,10 +63,10 @@ void ps2_irq(void) {
if (!(status & 1)) break; /* read while data available */
if (status & (1 << 5)) {
ring_put1b((void*)&mouse_backlog, port_in8(PS2));
- postqueue_pop(&mouse_queue, accept);
+ postqueue_ringreadall(&mouse_queue, (void*)&mouse_backlog);
} else {
ring_put1b((void*)&kb_backlog, port_in8(PS2));
- postqueue_pop(&kb_queue, accept);
+ postqueue_ringreadall(&kb_queue, (void*)&kb_backlog);
}
}
}
@@ -107,9 +107,11 @@ static void accept(struct vfs_request *req) {
ret = req_readcopy(req, data, sizeof data);
vfsreq_finish_short(req, ret);
} else if ((long __force)req->id == H_KB) {
- read_backlog(req, (void*)&kb_backlog, &kb_queue);
+ postqueue_join(&kb_queue, req);
+ postqueue_ringreadall(&kb_queue, (void*)&kb_backlog);
} else if ((long __force)req->id == H_MOUSE) {
- read_backlog(req, (void*)&mouse_backlog, &mouse_queue);
+ postqueue_join(&mouse_queue, req);
+ postqueue_ringreadall(&mouse_queue, (void*)&mouse_backlog);
} else panic_invalid_state();
break;
default: