]> git.dujemihanovic.xyz Git - nameless-os.git/blob - include/arch/x86/io.h
Handle interrupts
[nameless-os.git] / include / arch / x86 / io.h
1 #ifndef X86_IO_H
2 #define X86_IO_H
3
4 #include <stdint.h>
5
6 static inline void outb(uint16_t port, uint8_t value)
7 {
8 asm volatile ("outb %0, %1": : "a" (value), "Nd" (port));
9 }
10
11 static inline uint8_t inb(uint16_t port)
12 {
13 uint8_t ret;
14 asm volatile ("inb %1, %0"
15 : "=a" (ret)
16 : "d" (port));
17 return ret;
18 }
19
20 static inline void io_wait(void)
21 {
22 inb(0x80);
23 }
24
25 #endif