cpu: cpu_cache_line_size

This commit is contained in:
Matheus
2026-07-17 18:06:03 -03:00
parent 6f0596b00f
commit babc6f3e06
2 changed files with 16 additions and 0 deletions
+15
View File
@@ -18,6 +18,21 @@
static bool has_smap;
static bool has_smap_detected;
static bool has_smep;
static size_t cache_line_size;
size_t cpu_cache_line_size(void) {
size_t size = cache_line_size;
if (size)
return size;
uint32_t eax, ebx, ecx, edx;
__assert(__get_cpuid(1, &eax, &ebx, &ecx, &edx));
size = ((ebx >> 8) & 0xff) * 8;
__assert(size);
cache_line_size = size;
return size;
}
void arch_syscall_entry();
static void illisr(isr_t *self, context_t *ctx) {
+1
View File
@@ -114,6 +114,7 @@ static inline uint16_t be_to_cpu_w(uint16_t w) {
}
cpu_t *get_bsp(void);
size_t cpu_cache_line_size(void);
void arch_cpu_user_access_begin(void);
void arch_cpu_user_access_end(void);
bool arch_cpu_smep_enabled(void);