diff options
author | Danny Holman <dholman@gymli.org> | 2025-01-12 01:17:36 -0600 |
---|---|---|
committer | Danny Holman <dholman@gymli.org> | 2025-01-12 01:19:11 -0600 |
commit | 95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf (patch) | |
tree | c8c35347b50477929727fa5be9f5d0f55cbe18fd /arch/i386/include/kernel/asm.h | |
parent | arch: i386: kmalloc: fix last element being ignored (diff) | |
download | box-95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf.tar.gz box-95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf.tar.zst box-95cd78840f0891e60f5ebecc8a8eb4fbaf3c2ebf.zip |
PROJECT RESTRUCTURING
Move the entire kernel into its own directory. Create new directories
for system commands, libraries and other required essentials for a
complete Unix-like operating system.
Signed-off-by: Danny Holman <dholman@gymli.org>
Diffstat (limited to '')
-rw-r--r-- | kernel/arch/x86/include/kernel/asm.h (renamed from arch/i386/include/kernel/asm.h) | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/arch/i386/include/kernel/asm.h b/kernel/arch/x86/include/kernel/asm.h index cc570c5..18f53c4 100644 --- a/arch/i386/include/kernel/asm.h +++ b/kernel/arch/x86/include/kernel/asm.h @@ -3,6 +3,7 @@ #include <kernel/gdt.h> #include <stdint.h> +#include <cpuid.h> #define PCI_CONFIG_ADDR 0xCF8 #define PCI_CONFIG_DATA 0xCFC @@ -47,6 +48,12 @@ struct isr_frame { uint32_t eflags; } __attribute__((packed)); +struct cpuid_info { + char vendorID[12]; + uint32_t feat_ecx; + uint32_t feat_edx; +}; + void isr_stub_0(void); void isr_stub_1(void); void isr_stub_2(void); @@ -99,12 +106,14 @@ void irq_stub_15(void); void isr_stub_128(void); -void aquire_lock(int *lock); -void release_lock(int *lock); - void enable_paging(uint32_t new_cr3); +int cpuid_check(void); void flush_gdt(void); +static inline void cpuid(int code, uint32_t *ecx, uint32_t *ebx) { + __asm__ volatile("cpuid" : "=a"(*ecx), "=d"(*ebx) : "a"(code) : "ecx","ebx"); +} + static inline void outb(uint16_t port, uint8_t value) { __asm__ volatile("outb %0, %1" : : "a"(value), "Nd"(port)); } |