pr: Removed Unnessisary Flipping on kconsole leading to Vastly Faster Boot Times & PS/2 Hardware Correctness (#12)

* Flush PS/2 Devices on boot to avoid Locking dependent on the out buffer on real hardware / emulated PS2 over USB

Removed Slow and Unnessisarty flipping causing kconsole write slowdowns consequently speeding up the boot process

* sod wc
This commit is contained in:
Myles "Mellurboo" Wilson
2026-05-10 10:22:18 +01:00
committed by GitHub
parent e9888f26b1
commit fdcfd48a24
6 changed files with 30 additions and 6 deletions

View File

@@ -1,5 +1,7 @@
#include "keyboard.h"
#include "keymap.h"
#include "../core/io.h"
#include "../dev/ps2.h"
typedef struct {
bool e0_prefix;
@@ -88,6 +90,17 @@ static const uint16_t set1_ext[128] = {
};
void keyboard_init(void) {
/*
Flush all data in the controller output buffer
this can cause the PS/2 Keyboard device to not work
on real hardware specifically
(even when Legacy USB keyboard Emulation is emulating the PS/2 keyboard)
Myles
*/
int limit = 128;
while (limit-- > 0 && (inb(PS2_STATUS_PORT) & PS2_STATUS_OUT_FULL))
(void)inb(KBD_DATA_PORT);
g_kb.e0_prefix = false;
g_kb.left_shift = false;
g_kb.right_shift = false;

View File

@@ -1,6 +1,9 @@
#ifndef KEYBOARD_H
#define KEYBOARD_H
#define KBD_DATA_PORT 0x60
#define KBD_CMD_PORT 0x64
#include <stdint.h>
#include <stdbool.h>
#include "keycodes.h"