diff options
Diffstat (limited to 'arch/i686/include/sys')
-rw-r--r-- | arch/i686/include/sys/control.h | 9 | ||||
-rw-r--r-- | arch/i686/include/sys/cpuid.h | 35 | ||||
-rw-r--r-- | arch/i686/include/sys/io.h | 79 |
3 files changed, 0 insertions, 123 deletions
diff --git a/arch/i686/include/sys/control.h b/arch/i686/include/sys/control.h deleted file mode 100644 index a40a67f..0000000 --- a/arch/i686/include/sys/control.h +++ /dev/null @@ -1,9 +0,0 @@ -#pragma once - -static void -abort() -{ - asm volatile(R"(cli -h: hlt -jmp h)"); -} diff --git a/arch/i686/include/sys/cpuid.h b/arch/i686/include/sys/cpuid.h deleted file mode 100644 index f2ffe37..0000000 --- a/arch/i686/include/sys/cpuid.h +++ /dev/null @@ -1,35 +0,0 @@ -#pragma once - -#include <cpuid.h> - -struct CPUVersion { - unsigned int stepping : 4; - unsigned int model : 4; - unsigned int family : 4; - unsigned int type : 2; - unsigned int __unused_1 : 2; - unsigned int model_ex : 4; - unsigned int family_ex : 8; - unsigned int __unused_2 : 4; -} __attribute__((packed, aligned(__alignof__(unsigned int)))); -_Static_assert(sizeof(struct CPUVersion) == sizeof(unsigned int)); - -unsigned int -family(const struct CPUVersion v) -{ - if (v.family == 0x0f) return v.family + v.family_ex; - else - return v.family; -} - -unsigned int -model(const struct CPUVersion v) -{ - switch (v.family) { - case 0x06: - case 0x0f: - return ((unsigned int)v.model_ex << 4) | v.model; - default: - return v.model; - } -} diff --git a/arch/i686/include/sys/io.h b/arch/i686/include/sys/io.h deleted file mode 100644 index 74d4950..0000000 --- a/arch/i686/include/sys/io.h +++ /dev/null @@ -1,79 +0,0 @@ -#pragma once - -static inline void -outb(unsigned char val, unsigned short port) -{ - asm volatile("outb %0,%1" : : "a"(val), "dN"(port)); -} - -static inline void -outw(unsigned short val, unsigned short port) -{ - asm volatile("outw %0,%1" : : "a"(val), "dN"(port)); -} - -static inline void -outl(unsigned int val, unsigned short port) -{ - asm volatile("outl %0,%1" : : "a"(val), "dN"(port)); -} - -static inline unsigned char -inb(unsigned short port) -{ - unsigned char val; - asm volatile("inb %1,%0" : "=a"(val) : "dN"(port)); - return val; -} - -static inline unsigned short -inw(unsigned short port) -{ - unsigned short val; - asm volatile("inw %1,%0" : "=a"(val) : "dN"(port)); - return val; -} - -static inline unsigned int -inl(unsigned short port) -{ - unsigned int val; - asm volatile("inl %1,%0" : "=a"(val) : "dN"(port)); - return val; -} - -static inline void -outsb(unsigned short port, const void *__buf, unsigned long __n) -{ - asm volatile("cld; rep; outsb" : "+S"(__buf), "+c"(__n) : "d"(port)); -} - -static inline void -outsw(unsigned short port, const void *__buf, unsigned long __n) -{ - asm volatile("cld; rep; outsw" : "+S"(__buf), "+c"(__n) : "d"(port)); -} - -static inline void -outsl(unsigned short port, const void *__buf, unsigned long __n) -{ - asm volatile("cld; rep; outsl" : "+S"(__buf), "+c"(__n) : "d"(port)); -} - -static inline void -insb(unsigned short port, void *__buf, unsigned long __n) -{ - asm volatile("cld; rep; insb" : "+D"(__buf), "+c"(__n) : "d"(port)); -} - -static inline void -insw(unsigned short port, void *__buf, unsigned long __n) -{ - asm volatile("cld; rep; insw" : "+D"(__buf), "+c"(__n) : "d"(port)); -} - -static inline void -insl(unsigned short port, void *__buf, unsigned long __n) -{ - asm volatile("cld; rep; insl" : "+D"(__buf), "+c"(__n) : "d"(port)); -} |