From 8c02bc1301d6ef357db971b30fb8d2f44425cb79 Mon Sep 17 00:00:00 2001 From: Anna Lyons Date: Tue, 11 Apr 2017 13:57:47 +1000 Subject: [PATCH] x64: implement seL4_BenchmarkFlushCaches by moving the ia32 implementation up a level to x86 and implementing the syscall stub. --- include/arch/x86/arch/32/mode/machine.h | 12 ------------ include/arch/x86/arch/machine/hardware.h | 12 ++++++++++++ .../x86_64/sel4/sel4_arch/syscalls.h | 7 +++++++ 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/include/arch/x86/arch/32/mode/machine.h b/include/arch/x86/arch/32/mode/machine.h index 9c28163e9..f48ee82d2 100644 --- a/include/arch/x86/arch/32/mode/machine.h +++ b/include/arch/x86/arch/32/mode/machine.h @@ -82,18 +82,6 @@ static inline void invalidateLocalTranslationAll(void) invalidateLocalPageStructureCache(); } -/* Flushes entire CPU Cache */ -static inline void ia32_wbinvd(void) -{ - asm volatile("wbinvd" ::: "memory"); -} - -static inline void -arch_clean_invalidate_caches(void) -{ - ia32_wbinvd(); -} - static inline rdmsr_safe_result_t x86_rdmsr_safe(const uint32_t reg) { uint32_t low; diff --git a/include/arch/x86/arch/machine/hardware.h b/include/arch/x86/arch/machine/hardware.h index 449088935..feb2659a0 100644 --- a/include/arch/x86/arch/machine/hardware.h +++ b/include/arch/x86/arch/machine/hardware.h @@ -97,4 +97,16 @@ void flushCacheRange(void* vaddr, uint32_t size_bits); /* Disables a variety of prefetchers */ bool_t disablePrefetchers(void); +/* Flushes entire CPU Cache */ +static inline void x86_wbinvd(void) +{ + asm volatile("wbinvd" ::: "memory"); +} + +static inline void +arch_clean_invalidate_caches(void) +{ + x86_wbinvd(); +} + #endif diff --git a/libsel4/sel4_arch_include/x86_64/sel4/sel4_arch/syscalls.h b/libsel4/sel4_arch_include/x86_64/sel4/sel4_arch/syscalls.h index 4ee9e8750..55a53abce 100644 --- a/libsel4/sel4_arch_include/x86_64/sel4/sel4_arch/syscalls.h +++ b/libsel4/sel4_arch_include/x86_64/sel4/sel4_arch/syscalls.h @@ -454,6 +454,13 @@ seL4_BenchmarkNullSyscall(void) asm volatile("" ::: "memory"); } +LIBSEL4_INLINE_FUNC void +seL4_BenchmarkFlushCaches(void) +{ + x64_sys_null(seL4_SysBenchmarkFlushCaches); + asm volatile("" ::: "memory"); +} + #ifdef CONFIG_BENCHMARK_TRACK_UTILISATION LIBSEL4_INLINE_FUNC void seL4_BenchmarkGetThreadUtilisation(seL4_Word tcb_cptr)