mirror of
https://github.com/Mathewnd/Astral.git
synced 2026-10-27 12:48:22 +00:00
cpu: cpu_cache_line_size
This commit is contained in:
@@ -18,6 +18,21 @@
|
|||||||
static bool has_smap;
|
static bool has_smap;
|
||||||
static bool has_smap_detected;
|
static bool has_smap_detected;
|
||||||
static bool has_smep;
|
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();
|
void arch_syscall_entry();
|
||||||
static void illisr(isr_t *self, context_t *ctx) {
|
static void illisr(isr_t *self, context_t *ctx) {
|
||||||
|
|||||||
@@ -114,6 +114,7 @@ static inline uint16_t be_to_cpu_w(uint16_t w) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
cpu_t *get_bsp(void);
|
cpu_t *get_bsp(void);
|
||||||
|
size_t cpu_cache_line_size(void);
|
||||||
void arch_cpu_user_access_begin(void);
|
void arch_cpu_user_access_begin(void);
|
||||||
void arch_cpu_user_access_end(void);
|
void arch_cpu_user_access_end(void);
|
||||||
bool arch_cpu_smep_enabled(void);
|
bool arch_cpu_smep_enabled(void);
|
||||||
|
|||||||
Reference in New Issue
Block a user