feat(kernel): implement Phase 2 - IDT64, 8259 PIC, 100Hz PIT timer & PS/2 keyboard driver

This commit is contained in:
Adam Eehan committed 2026-10-23 09:37:54 +05:30
1 parent eec88c14c0
commit 7251770d7f
16 files changed
+863 -19

No files matched your search

+33
View File
@@ -0,0 +1,33 @@
#ifndef AIRLYS_IO_H
#define AIRLYS_IO_H
#include <airlys/types.h>
/* Direct Hardware I/O Port operations */
static inline void outb(uint16_t port, uint8_t val) {
__asm__ volatile ("outb %0, %1" : : "a"(val), "Nd"(port));
}
static inline uint8_t inb(uint16_t port) {
uint8_t ret;
__asm__ volatile ("inb %1, %0" : "=a"(ret) : "Nd"(port));
return ret;
}
static inline void outw(uint16_t port, uint16_t val) {
__asm__ volatile ("outw %0, %1" : : "a"(val), "Nd"(port));
}
static inline uint16_t inw(uint16_t port) {
uint16_t ret;
__asm__ volatile ("inw %1, %0" : "=a"(ret) : "Nd"(port));
return ret;
}
/* Wait for I/O operations to complete (useful for PIC remapping) */
static inline void io_wait(void) {
outb(0x80, 0);
}
#endif /* AIRLYS_IO_H */