diff options
Diffstat (limited to 'kernel/include')
-rw-r--r-- | kernel/include/comus/cpu.h | 65 |
1 files changed, 38 insertions, 27 deletions
diff --git a/kernel/include/comus/cpu.h b/kernel/include/comus/cpu.h index 9909a57..ffc1782 100644 --- a/kernel/include/comus/cpu.h +++ b/kernel/include/comus/cpu.h @@ -10,33 +10,24 @@ #define _CPU_H #include <stdint.h> +#include <stdbool.h> -union cpu_rflags { - uint64_t raw; - struct { - uint64_t cf : 1; - uint64_t : 1; - uint64_t pf : 1; - uint64_t : 1; - uint64_t af : 1; - uint64_t : 1; - uint64_t zf : 1; - uint64_t sf : 1; - uint64_t tf : 1; - uint64_t if_ : 1; - uint64_t df : 1; - uint64_t of : 1; - uint64_t iopl : 2; - uint64_t nt : 1; - uint64_t md : 1; - uint64_t rf : 1; - uint64_t vm : 1; - uint64_t ac : 1; - uint64_t vif : 1; - uint64_t vip : 1; - uint64_t id : 1; - uint64_t : 42; - }; +struct cpu_feat { + // floating point + uint32_t fpu : 1; + // simd + uint32_t mmx : 1; + uint32_t sse : 1; + uint32_t sse2 : 1; + uint32_t sse3 : 1; + uint32_t ssse3 : 1; + uint32_t sse41 : 1; + uint32_t sse42 : 1; + uint32_t sse4a : 1; + uint32_t avx : 1; + uint32_t xsave : 1; + uint32_t avx2 : 1; + uint32_t avx512 : 1; }; struct cpu_regs { @@ -61,7 +52,7 @@ struct cpu_regs { // code segment uint64_t cs; // rflags - union cpu_rflags rflags; + uint64_t rflags; // stack pointer uint64_t rsp; // stack segment @@ -74,6 +65,26 @@ struct cpu_regs { void cpu_init(void); /** + * Report all cpu information + */ +void cpu_report(void); + +/** + * @returns the name/model of the cpu + */ +void cpu_name(char name[48]); + +/** + * @returns the vendor of the cpu + */ +void cpu_vendor(char vendor[12]); + +/** + * @returns get features of the cpu + */ +void cpu_feats(struct cpu_feat *feats); + +/** * Dump registers to output */ void cpu_print_regs(struct cpu_regs *regs); |