ref: 683965b944f2e1a922f26c3496e2aae867ca70ec
parent: 40dcd63f5b1583af346e7d241211b2bf7026638a
author: mkf <mkf@cloud9p.org>
date: Mon Dec 4 11:04:32 EST 2023
x86.{c,h}: get rid of unused functions and macros, use inline functions
--- a/include/x86.h
+++ b/include/x86.h
@@ -9,15 +9,5 @@
#define VGAC 0x3d4
#define VGAD 0x3d5
-#define outb(port,data) asm volatile("out %0, %1" : : "a" (data), "d" (port));
-
-#define inb(port) ({ \
-unsigned char _v; \
-__asm__ volatile ("inb %%dx,%%al":"=a" (_v):"d" (port)); \
-_v; \
-})
-
-void instr(uint16 port, uint8* address, uint32 size);
-void sti(void);
-void cli(void);
-void nop(void);
+extern inline uint8 inb(uint16 port);
+extern inline void outb(uint16 port, uint8 data);
\ No newline at end of file
--- a/pc/x86.c
+++ b/pc/x86.c
@@ -1,28 +1,14 @@
#include <u.h>
-inline void
-instr(uint16 port, uint8* address, uint32 size)
-{
- asm volatile("cld; rep insl" :
- "=D" (address), "=c" (size) :
- "d" (port), "0" (address), "1" (size) :
- "memory", "cc");
+extern inline void
+outb(uint16 port, uint8 data)
+{
+ asm volatile("out %0, %1" : : "a" (data), "d" (port));
}
-inline void
-sti(void)
-{
- asm volatile("sti");
+extern inline uint8
+inb(uint16 port) {
+ uint8 data;
+ asm volatile("in %1, %0" : "=a" (data) : "d" (port));
+ return data;
}
-
-inline void
-cli(void)
-{
- asm volatile("cli");
-}
-
-inline void
-nop(void)
-{
- asm volatile("nop");
-}
\ No newline at end of file