diff --git a/Kconfig b/Kconfig index 0bebcb117..6c16e6e10 100644 --- a/Kconfig +++ b/Kconfig @@ -552,6 +552,12 @@ menu "Build Options" config NO_BENCHMARKS bool "No benchmarking features enabled" + config BENCHMARK_GENERIC + bool "Enable generic benchmarks" + select ENABLE_BENCHMARKS + help + Enable global benchmarks config variable with no specific features + config BENCHMARK_TRACK_KERNEL_ENTRIES bool "Keep track of kernel entries" select ENABLE_BENCHMARKS diff --git a/libsel4/include/api/syscall.xml b/libsel4/include/api/syscall.xml index 67c070266..37792580d 100644 --- a/libsel4/include/api/syscall.xml +++ b/libsel4/include/api/syscall.xml @@ -41,6 +41,7 @@ + diff --git a/libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/syscalls.h b/libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/syscalls.h index 370b97583..a29e5b5a6 100644 --- a/libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/syscalls.h +++ b/libsel4/sel4_arch_include/aarch32/sel4/sel4_arch/syscalls.h @@ -626,6 +626,17 @@ seL4_BenchmarkSetLogBuffer(seL4_Word frame_cptr) return (seL4_Error) arg1; } + +static inline void +seL4_BenchmarkNullSyscall(void) +{ + register seL4_Word scno asm("r7") = seL4_SysBenchmarkNullSyscall; + asm volatile ("swi %[swi_num]" + : /* no outputs */ + : [swi_num] "i" __SEL4_SWINUM(seL4_SysBenchmarkNullSyscall), "r"(scno) + : "memory"); +} + #ifdef CONFIG_BENCHMARK_TRACK_UTILISATION static inline void seL4_BenchmarkGetThreadUtilisation(seL4_Word tcp_cptr) diff --git a/libsel4/sel4_arch_include/ia32/sel4/sel4_arch/syscalls.h b/libsel4/sel4_arch_include/ia32/sel4/sel4_arch/syscalls.h index 120d55678..3af478a4f 100644 --- a/libsel4/sel4_arch_include/ia32/sel4/sel4_arch/syscalls.h +++ b/libsel4/sel4_arch_include/ia32/sel4/sel4_arch/syscalls.h @@ -730,6 +730,25 @@ seL4_BenchmarkSetLogBuffer(seL4_Word frame_cptr) return (seL4_Error) frame_cptr; } + +static inline void +seL4_BenchmarkNullSyscall(void) +{ + asm volatile ( + "pushl %%ebp \n" + SEL4_REGS_SAVE + "movl %%esp, %%ecx \n" + "leal 1f, %%edx \n" + "1: \n" + "sysenter \n" + SEL4_REGS_RESTORE + "popl %%ebp \n" + : + : "a" (seL4_SysBenchmarkNullSyscall) + : SEL4_REGS_CLOBBER_EBX "%ecx", "%edx", "%esi", "%edi", "memory" + ); +} + #ifdef CONFIG_BENCHMARK_TRACK_UTILISATION static inline void seL4_BenchmarkGetThreadUtilisation(seL4_Word tcb_cptr) diff --git a/src/api/syscall.c b/src/api/syscall.c index b1bd25a64..15b3c8970 100644 --- a/src/api/syscall.c +++ b/src/api/syscall.c @@ -171,6 +171,9 @@ handleUnknownSyscall(word_t w) } #endif /* CONFIG_BENCHMARK_TRACK_UTILISATION */ + else if (w == SysBenchmarkNullSyscall) { + return EXCEPTION_NONE; + } #endif /* CONFIG_ENABLE_BENCHMARKS */ current_fault = fault_unknown_syscall_new(w);