diff options
author | aqua <aqua@iserlohn-fortress.net> | 2024-03-08 17:24:49 +0200 |
---|---|---|
committer | aqua <aqua@iserlohn-fortress.net> | 2024-03-08 22:00:07 +0200 |
commit | 20b97ea7c0dbbdc13800e12ff5c86c00c4a342ec (patch) | |
tree | 473281e5fc8b256827ce1a678573444e1aa5f669 /i686/include/sys | |
parent | Generate src/conf.h (diff) | |
download | kernel-20b97ea7c0dbbdc13800e12ff5c86c00c4a342ec.tar.xz |
Bazel build
Diffstat (limited to 'i686/include/sys')
-rw-r--r-- | i686/include/sys/control.h | 24 | ||||
-rw-r--r-- | i686/include/sys/cpuid.h | 35 | ||||
-rw-r--r-- | i686/include/sys/io.h | 92 | ||||
-rw-r--r-- | i686/include/sys/syscall.h | 8 |
4 files changed, 0 insertions, 159 deletions
diff --git a/i686/include/sys/control.h b/i686/include/sys/control.h deleted file mode 100644 index 89ab067..0000000 --- a/i686/include/sys/control.h +++ /dev/null @@ -1,24 +0,0 @@ -#pragma once - -static __inline__ void -abort() -{ - /* Symbol h is already defined? -__asm__(R"(cli -h: hlt -jmp h)"); -*/ - __asm__("cli; hlt"); -} - -static __inline__ void -enable_interrupts() -{ - __asm__("sti"); -} - -static __inline__ void -disable_interrupts() -{ - __asm__("cli"); -} diff --git a/i686/include/sys/cpuid.h b/i686/include/sys/cpuid.h deleted file mode 100644 index 6613967..0000000 --- a/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)))); -/* FIXME _Static_assert(sizeof(struct CPUVersion) == sizeof(unsigned int), "cpuid version struct size"); */ - -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/i686/include/sys/io.h b/i686/include/sys/io.h deleted file mode 100644 index 4ff5d85..0000000 --- a/i686/include/sys/io.h +++ /dev/null @@ -1,92 +0,0 @@ -#pragma once - -/* port listings */ -enum UART { - COM1 = 0x3f8, - COM2 = 0x2f8, - COM3 = 0x3e8, - COM4 = 0x2e8, - COM5 = 0x5f8, - COM6 = 0x4f8, - COM7 = 0x5e8, - COM8 = 0x4e8 -}; - -static __inline__ void -outb(unsigned char val, unsigned short port) -{ - __asm__("outb %0,%1" : : "a"(val), "dN"(port)); -} - -static __inline__ void -outw(unsigned short val, unsigned short port) -{ - __asm__("outw %0,%1" : : "a"(val), "dN"(port)); -} - -static __inline__ void -outl(unsigned int val, unsigned short port) -{ - __asm__("outl %0,%1" : : "a"(val), "dN"(port)); -} - -static __inline__ unsigned char -inb(unsigned short port) -{ - unsigned char val; - __asm__("inb %1,%0" : "=a"(val) : "dN"(port)); - return val; -} - -static __inline__ unsigned short -inw(unsigned short port) -{ - unsigned short val; - __asm__("inw %1,%0" : "=a"(val) : "dN"(port)); - return val; -} - -static __inline__ unsigned int -inl(unsigned short port) -{ - unsigned int val; - __asm__("inl %1,%0" : "=a"(val) : "dN"(port)); - return val; -} - -static __inline__ void -outsb(unsigned short port, const void *__buf, unsigned long __n) -{ - __asm__("cld; rep; outsb" : "+S"(__buf), "+c"(__n) : "d"(port)); -} - -static __inline__ void -outsw(unsigned short port, const void *__buf, unsigned long __n) -{ - __asm__("cld; rep; outsw" : "+S"(__buf), "+c"(__n) : "d"(port)); -} - -static __inline__ void -outsl(unsigned short port, const void *__buf, unsigned long __n) -{ - __asm__("cld; rep; outsl" : "+S"(__buf), "+c"(__n) : "d"(port)); -} - -static __inline__ void -insb(unsigned short port, void *__buf, unsigned long __n) -{ - __asm__("cld; rep; insb" : "+D"(__buf), "+c"(__n) : "d"(port)); -} - -static __inline__ void -insw(unsigned short port, void *__buf, unsigned long __n) -{ - __asm__("cld; rep; insw" : "+D"(__buf), "+c"(__n) : "d"(port)); -} - -static __inline__ void -insl(unsigned short port, void *__buf, unsigned long __n) -{ - __asm__("cld; rep; insl" : "+D"(__buf), "+c"(__n) : "d"(port)); -} - diff --git a/i686/include/sys/syscall.h b/i686/include/sys/syscall.h deleted file mode 100644 index 9e62c89..0000000 --- a/i686/include/sys/syscall.h +++ /dev/null @@ -1,8 +0,0 @@ -#pragma once - -static inline int -syscall(int number) -{ - asm volatile("int $0x80"); - return 0; -} |