Files
kern/include/system.h
T
Tom-on 1d71a4e384 [ BIG CHANGE ] Properly Implemented IDT
- New include files: idt.h, pic.h, syscall.h and exceptions.h
- Proper exception handling (still could be improved
- PIC properly initiated and irqs all masked
- BREAKS Keyboard - The keyboard IRQ is not handled anymore
- convertColor() is kinda broken :/ (More in README.md)
2024-05-05 21:03:21 +02:00

33 lines
683 B
C

#ifndef SYSTEM_H
#define SYSTEM_H
#include "stdint.h"
// Port functions
uint8_t inb(uint16_t port) {
uint8_t result;
asm volatile("inb %1, %0" : "=a"(result) : "Nd"(port));
return result;
}
void outb(uint16_t port, uint8_t data) {
asm volatile("outb %0, %1" :: "a"(data), "Nd"(port));
}
uint16_t inw(uint16_t port) {
uint16_t result;
asm volatile("inw %1, %0" : "=a"(result) : "Nd"(port));
return result;
}
void outw(uint16_t port, uint16_t data) {
asm volatile("outw %0, %1" :: "a"(data), "Nd"(port));
}
void ioWait() {
// Waits ~1 I/O Cycle (Linux uses this so it should be good)
asm volatile("outb %%al, $0x80" : : "a"(0));
}
#endif